home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / develop™ Technical Journal / develop Issue 29 code / InlineInputSample.sit / InlineInputSample / InlineInputSample.c < prev    next >
MacBinary  |  1997-01-07  |  68.5 KB  |  [TEXT/CWIE]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: MacBinary (archive/macBinary).

ConfidenceProgramDetectionMatch TypeSupport
66% dexvert Compact Compressed (Unix) (archive/compact) ext Supported
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, inited, Tue Jan 7 11:03:32 1997, modified Tue Jan 7 11:03:32 1997, creator 'CWIE', type ASCII, 69309 bytes "InlineInputSample.c" , at 0x10f3d 530 bytes resource default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[CWIE]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 13 49 6e 6c 69 6e 65 | 49 6e 70 75 74 53 61 6d |..Inline|InputSam|
|00000010| 70 6c 65 2e 63 00 00 00 | 00 00 00 00 00 00 00 00 |ple.c...|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 43 57 49 | 45 01 00 00 00 00 00 00 |.TEXTCWI|E.......|
|00000050| 00 00 00 00 01 0e bd 00 | 00 02 12 ae f8 24 54 ae |........|.....$T.|
|00000060| f8 24 54 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |.$T.....|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 38 f0 00 00 |........|....8...|
|00000080| 2f 2a 0d 09 46 69 6c 65 | 3a 09 09 49 6e 6c 69 6e |/*..File|:..Inlin|
|00000090| 65 49 6e 70 75 74 53 61 | 6d 70 6c 65 2e 63 0d 0d |eInputSa|mple.c..|
|000000a0| 09 43 6f 6e 74 61 69 6e | 73 3a 09 43 20 73 6f 75 |.Contain|s:.C sou|
|000000b0| 72 63 65 20 66 69 6c 65 | 20 66 6f 72 20 49 6e 6c |rce file| for Inl|
|000000c0| 69 6e 65 49 6e 70 75 74 | 53 61 6d 70 6c 65 0d 0d |ineInput|Sample..|
|000000d0| 09 43 6f 70 79 72 69 67 | 68 74 3a 09 a9 20 31 39 |.Copyrig|ht:.. 19|
|000000e0| 38 39 2d 31 39 39 34 20 | 41 70 70 6c 65 20 43 6f |89-1994 |Apple Co|
|000000f0| 6d 70 75 74 65 72 2c 20 | 49 6e 63 2e 20 41 6c 6c |mputer, |Inc. All|
|00000100| 20 72 69 67 68 74 73 20 | 72 65 73 65 72 76 65 64 | rights |reserved|
|00000110| 2e 0d 0d 2a 2f 0d 0d 0d | 2f 2a 20 53 65 67 6d 65 |...*/...|/* Segme|
|00000120| 6e 74 61 74 69 6f 6e 20 | 73 74 72 61 74 65 67 79 |ntation |strategy|
|00000130| 3a 0d 0d 20 20 20 54 68 | 65 72 65 20 69 73 6e 27 |:.. Th|ere isn'|
|00000140| 74 20 61 6e 79 2e 20 44 | 65 70 65 6e 64 69 6e 67 |t any. D|epending|
|00000150| 20 6f 6e 20 77 68 69 63 | 68 20 63 6f 6d 70 69 6c | on whic|h compil|
|00000160| 65 72 20 79 6f 75 20 75 | 73 65 2c 20 61 6e 64 20 |er you u|se, and |
|00000170| 77 68 65 74 68 65 72 20 | 79 6f 75 20 62 75 69 6c |whether |you buil|
|00000180| 64 20 66 6f 72 0d 20 20 | 20 4d 61 63 2d 4f 53 20 |d for. | Mac-OS |
|00000190| 36 38 4b 2c 20 41 2f 55 | 58 2c 20 6f 72 20 50 6f |68K, A/U|X, or Po|
|000001a0| 77 65 72 50 43 2c 20 73 | 65 67 6d 65 6e 74 73 20 |werPC, s|egments |
|000001b0| 6d 61 79 20 6c 6f 6f 6b | 20 64 69 66 66 65 72 65 |may look| differe|
|000001c0| 6e 74 20 6f 72 20 6e 6f | 74 20 65 78 69 73 74 20 |nt or no|t exist |
|000001d0| 61 74 20 61 6c 6c 2e 0d | 20 20 20 41 6e 64 20 77 |at all..| And w|
|000001e0| 69 74 68 20 61 6e 20 61 | 70 70 6c 69 63 61 74 69 |ith an a|pplicati|
|000001f0| 6f 6e 20 74 68 69 73 20 | 73 6d 61 6c 6c 2c 20 73 |on this |small, s|
|00000200| 65 67 6d 65 6e 74 73 20 | 64 6f 6e 27 74 20 72 65 |egments |don't re|
|00000210| 61 6c 6c 79 20 6d 61 74 | 74 65 72 20 61 6e 79 20 |ally mat|ter any |
|00000220| 6d 6f 72 65 20 74 68 65 | 73 65 0d 20 20 20 64 61 |more the|se. da|
|00000230| 79 73 2e 20 53 6f 20 77 | 65 20 64 6f 6e 27 74 20 |ys. So w|e don't |
|00000240| 74 72 79 20 74 6f 20 66 | 69 67 75 72 65 20 6f 75 |try to f|igure ou|
|00000250| 74 20 73 65 67 6d 65 6e | 74 61 74 69 6f 6e 20 61 |t segmen|tation a|
|00000260| 6e 64 20 73 65 67 6d 65 | 6e 74 20 75 6e 6c 6f 61 |nd segme|nt unloa|
|00000270| 64 69 6e 67 20 73 74 72 | 61 74 65 67 69 65 73 2e |ding str|ategies.|
|00000280| 0d 20 20 20 49 66 20 79 | 6f 75 20 77 61 6e 74 20 |. If y|ou want |
|00000290| 74 6f 20 66 69 6e 64 20 | 6f 75 74 20 68 6f 77 20 |to find |out how |
|000002a0| 74 6f 20 73 65 67 6d 65 | 6e 74 20 79 6f 75 72 20 |to segme|nt your |
|000002b0| 61 70 70 6c 69 63 61 74 | 69 6f 6e 2c 20 6c 6f 6f |applicat|ion, loo|
|000002c0| 6b 20 61 74 20 73 6f 6d | 65 20 6f 74 68 65 72 0d |k at som|e other.|
|000002d0| 20 20 20 73 61 6d 70 6c | 65 20 63 6f 64 65 2e 0d | sampl|e code..|
|000002e0| 2a 2f 0d 0d 0d 2f 2a 20 | 53 65 74 50 6f 72 74 20 |*/.../* |SetPort |
|000002f0| 73 74 72 61 74 65 67 79 | 3a 0d 0d 20 20 20 54 6f |strategy|:.. To|
|00000300| 6f 6c 62 6f 78 20 72 6f | 75 74 69 6e 65 73 20 64 |olbox ro|utines d|
|00000310| 6f 20 6e 6f 74 20 63 68 | 61 6e 67 65 20 74 68 65 |o not ch|ange the|
|00000320| 20 63 75 72 72 65 6e 74 | 20 70 6f 72 74 2e 20 49 | current| port. I|
|00000330| 6e 20 73 70 69 74 65 20 | 6f 66 20 74 68 69 73 2c |n spite |of this,|
|00000340| 20 69 6e 20 74 68 69 73 | 0d 20 20 20 70 72 6f 67 | in this|. prog|
|00000350| 72 61 6d 20 77 65 20 75 | 73 65 20 61 20 73 74 72 |ram we u|se a str|
|00000360| 61 74 65 67 79 20 6f 66 | 20 63 61 6c 6c 69 6e 67 |ategy of| calling|
|00000370| 20 53 65 74 50 6f 72 74 | 20 77 68 65 6e 65 76 65 | SetPort| wheneve|
|00000380| 72 20 77 65 20 77 61 6e | 74 20 74 6f 20 64 72 61 |r we wan|t to dra|
|00000390| 77 20 6f 72 0d 20 20 20 | 6d 61 6b 65 20 63 61 6c |w or. |make cal|
|000003a0| 6c 73 20 77 68 69 63 68 | 20 64 65 70 65 6e 64 20 |ls which| depend |
|000003b0| 6f 6e 20 74 68 65 20 63 | 75 72 72 65 6e 74 20 70 |on the c|urrent p|
|000003c0| 6f 72 74 2e 20 54 68 69 | 73 20 6d 61 6b 65 73 20 |ort. Thi|s makes |
|000003d0| 75 73 20 6c 65 73 73 20 | 76 75 6c 6e 65 72 61 62 |us less |vulnerab|
|000003e0| 6c 65 0d 20 20 20 74 6f | 20 62 75 67 73 20 69 6e |le. to| bugs in|
|000003f0| 20 6f 74 68 65 72 20 73 | 6f 66 74 77 61 72 65 20 | other s|oftware |
|00000400| 77 68 69 63 68 20 6d 69 | 67 68 74 20 61 6c 74 65 |which mi|ght alte|
|00000410| 72 20 74 68 65 20 63 75 | 72 72 65 6e 74 20 70 6f |r the cu|rrent po|
|00000420| 72 74 20 28 73 75 63 68 | 20 61 73 20 74 68 65 0d |rt (such| as the.|
|00000430| 20 20 20 62 75 67 20 28 | 66 65 61 74 75 72 65 3f | bug (|feature?|
|00000440| 29 20 69 6e 20 6d 61 6e | 79 20 64 65 73 6b 20 61 |) in man|y desk a|
|00000450| 63 63 65 73 73 6f 72 69 | 65 73 20 77 68 69 63 68 |ccessori|es which|
|00000460| 20 63 68 61 6e 67 65 20 | 74 68 65 20 70 6f 72 74 | change |the port|
|00000470| 20 6f 6e 20 4f 70 65 6e | 44 65 73 6b 41 63 63 29 | on Open|DeskAcc)|
|00000480| 2e 0d 20 20 20 48 6f 70 | 65 66 75 6c 6c 79 2c 20 |.. Hop|efully, |
|00000490| 74 68 69 73 20 61 6c 73 | 6f 20 6d 61 6b 65 73 20 |this als|o makes |
|000004a0| 74 68 65 20 72 6f 75 74 | 69 6e 65 73 20 66 72 6f |the rout|ines fro|
|000004b0| 6d 20 74 68 69 73 20 70 | 72 6f 67 72 61 6d 20 6d |m this p|rogram m|
|000004c0| 6f 72 65 20 73 65 6c 66 | 2d 63 6f 6e 74 61 69 6e |ore self|-contain|
|000004d0| 65 64 2c 0d 20 20 20 73 | 69 6e 63 65 20 74 68 65 |ed,. s|ince the|
|000004e0| 79 20 64 6f 6e 27 74 20 | 64 65 70 65 6e 64 20 6f |y don't |depend o|
|000004f0| 6e 20 74 68 65 20 63 75 | 72 72 65 6e 74 20 70 6f |n the cu|rrent po|
|00000500| 72 74 20 73 65 74 74 69 | 6e 67 2e 0d 2a 2f 0d 0d |rt setti|ng..*/..|
|00000510| 0d 2f 2a 20 43 6c 69 70 | 62 6f 61 72 64 20 73 74 |./* Clip|board st|
|00000520| 72 61 74 65 67 79 3a 0d | 0d 20 20 20 55 6e 64 65 |rategy:.|. Unde|
|00000530| 72 20 73 74 79 6c 65 64 | 20 54 65 78 74 45 64 69 |r styled| TextEdi|
|00000540| 74 2c 20 54 45 43 75 74 | 20 61 6e 64 20 54 45 43 |t, TECut| and TEC|
|00000550| 6f 70 79 20 77 69 6c 6c | 20 77 72 69 74 65 20 62 |opy will| write b|
|00000560| 6f 74 68 20 74 68 65 20 | 74 65 78 74 20 61 6e 64 |oth the |text and|
|00000570| 20 61 73 73 6f 63 69 61 | 74 65 64 0d 20 20 20 73 | associa|ted. s|
|00000580| 74 79 6c 65 20 69 6e 66 | 6f 72 6d 61 74 69 6f 6e |tyle inf|ormation|
|00000590| 20 64 69 72 65 63 74 6c | 79 20 74 6f 20 74 68 65 | directl|y to the|
|000005a0| 20 64 65 73 6b 20 73 63 | 72 61 70 20 61 73 20 74 | desk sc|rap as t|
|000005b0| 79 70 65 73 20 27 54 45 | 58 54 27 20 61 6e 64 20 |ypes 'TE|XT' and |
|000005c0| 27 73 74 79 6c 27 2e 0d | 20 20 20 49 6e 73 74 65 |'styl'..| Inste|
|000005d0| 61 64 20 6f 66 20 75 73 | 69 6e 67 20 54 45 54 6f |ad of us|ing TETo|
|000005e0| 53 63 72 61 70 20 61 6e | 64 20 54 45 46 72 6f 6d |Scrap an|d TEFrom|
|000005f0| 53 63 72 61 70 2c 20 61 | 20 6e 65 77 20 72 6f 75 |Scrap, a| new rou|
|00000600| 74 69 6e 65 20 54 45 53 | 74 79 6c 50 61 73 74 65 |tine TES|tylPaste|
|00000610| 2c 20 77 69 6c 6c 20 0d | 20 20 20 74 72 61 6e 73 |, will .| trans|
|00000620| 66 65 72 20 74 68 65 20 | 74 65 78 74 20 61 6e 64 |fer the |text and|
|00000630| 20 73 74 79 6c 65 20 66 | 72 6f 6d 20 74 68 65 20 | style f|rom the |
|00000640| 64 65 73 6b 20 73 63 72 | 61 70 20 74 6f 20 74 68 |desk scr|ap to th|
|00000650| 65 20 64 6f 63 75 6d 65 | 6e 74 2e 0d 2a 2f 0d 0d |e docume|nt..*/..|
|00000660| 0d 23 69 66 20 71 49 6e | 6c 69 6e 65 0d 23 64 65 |.#if qIn|line.#de|
|00000670| 66 69 6e 65 20 71 41 70 | 70 6c 65 45 76 65 6e 74 |fine qAp|pleEvent|
|00000680| 73 20 31 0d 23 65 6e 64 | 69 66 0d 0d 0d 23 69 6e |s 1.#end|if...#in|
|00000690| 63 6c 75 64 65 20 3c 4c | 69 6d 69 74 73 2e 68 3e |clude <L|imits.h>|
|000006a0| 0d 23 69 6e 63 6c 75 64 | 65 20 3c 54 79 70 65 73 |.#includ|e <Types|
|000006b0| 2e 68 3e 0d 23 69 6e 63 | 6c 75 64 65 20 3c 51 75 |.h>.#inc|lude <Qu|
|000006c0| 69 63 6b 44 72 61 77 2e | 68 3e 0d 23 69 6e 63 6c |ickDraw.|h>.#incl|
|000006d0| 75 64 65 20 3c 46 6f 6e | 74 73 2e 68 3e 0d 23 69 |ude <Fon|ts.h>.#i|
|000006e0| 6e 63 6c 75 64 65 20 3c | 45 76 65 6e 74 73 2e 68 |nclude <|Events.h|
|000006f0| 3e 0d 23 69 6e 63 6c 75 | 64 65 20 3c 43 6f 6e 74 |>.#inclu|de <Cont|
|00000700| 72 6f 6c 73 2e 68 3e 0d | 23 69 6e 63 6c 75 64 65 |rols.h>.|#include|
|00000710| 20 3c 57 69 6e 64 6f 77 | 73 2e 68 3e 0d 23 69 6e | <Window|s.h>.#in|
|00000720| 63 6c 75 64 65 20 3c 4d | 65 6e 75 73 2e 68 3e 0d |clude <M|enus.h>.|
|00000730| 23 69 6e 63 6c 75 64 65 | 20 3c 54 65 78 74 45 64 |#include| <TextEd|
|00000740| 69 74 2e 68 3e 0d 23 69 | 6e 63 6c 75 64 65 20 3c |it.h>.#i|nclude <|
|00000750| 44 69 61 6c 6f 67 73 2e | 68 3e 0d 23 69 6e 63 6c |Dialogs.|h>.#incl|
|00000760| 75 64 65 20 3c 44 65 73 | 6b 2e 68 3e 0d 23 69 6e |ude <Des|k.h>.#in|
|00000770| 63 6c 75 64 65 20 3c 53 | 63 72 61 70 2e 68 3e 0d |clude <S|crap.h>.|
|00000780| 23 69 6e 63 6c 75 64 65 | 20 3c 54 6f 6f 6c 55 74 |#include| <ToolUt|
|00000790| 69 6c 73 2e 68 3e 0d 23 | 69 6e 63 6c 75 64 65 20 |ils.h>.#|include |
|000007a0| 3c 4d 65 6d 6f 72 79 2e | 68 3e 0d 23 69 6e 63 6c |<Memory.|h>.#incl|
|000007b0| 75 64 65 20 3c 53 65 67 | 4c 6f 61 64 2e 68 3e 0d |ude <Seg|Load.h>.|
|000007c0| 23 69 6e 63 6c 75 64 65 | 20 3c 46 69 6c 65 73 2e |#include| <Files.|
|000007d0| 68 3e 0d 23 69 6e 63 6c | 75 64 65 20 3c 4f 53 55 |h>.#incl|ude <OSU|
|000007e0| 74 69 6c 73 2e 68 3e 0d | 23 69 6e 63 6c 75 64 65 |tils.h>.|#include|
|000007f0| 20 3c 4f 53 45 76 65 6e | 74 73 2e 68 3e 0d 23 69 | <OSEven|ts.h>.#i|
|00000800| 6e 63 6c 75 64 65 20 3c | 50 61 63 6b 61 67 65 73 |nclude <|Packages|
|00000810| 2e 68 3e 0d 23 69 6e 63 | 6c 75 64 65 20 3c 54 72 |.h>.#inc|lude <Tr|
|00000820| 61 70 73 2e 68 3e 0d 23 | 69 6e 63 6c 75 64 65 20 |aps.h>.#|include |
|00000830| 3c 50 72 69 6e 74 69 6e | 67 2e 68 3e 0d 23 69 6e |<Printin|g.h>.#in|
|00000840| 63 6c 75 64 65 20 3c 44 | 69 73 6b 49 6e 69 74 2e |clude <D|iskInit.|
|00000850| 68 3e 0d 23 69 66 20 71 | 41 70 70 6c 65 45 76 65 |h>.#if q|AppleEve|
|00000860| 6e 74 73 0d 23 69 6e 63 | 6c 75 64 65 20 3c 45 72 |nts.#inc|lude <Er|
|00000870| 72 6f 72 73 2e 68 3e 0d | 23 69 6e 63 6c 75 64 65 |rors.h>.|#include|
|00000880| 20 3c 47 65 73 74 61 6c | 74 45 71 75 2e 68 3e 0d | <Gestal|tEqu.h>.|
|00000890| 23 69 6e 63 6c 75 64 65 | 20 3c 41 70 70 6c 65 45 |#include| <AppleE|
|000008a0| 76 65 6e 74 73 2e 68 3e | 0d 23 69 66 20 71 49 6e |vents.h>|.#if qIn|
|000008b0| 6c 69 6e 65 0d 23 69 6e | 63 6c 75 64 65 20 3c 54 |line.#in|clude <T|
|000008c0| 65 78 74 53 65 72 76 69 | 63 65 73 2e 68 3e 0d 23 |extServi|ces.h>.#|
|000008d0| 69 6e 63 6c 75 64 65 20 | 3c 53 63 72 69 70 74 2e |include |<Script.|
|000008e0| 68 3e 0d 23 69 6e 63 6c | 75 64 65 20 22 54 53 4d |h>.#incl|ude "TSM|
|000008f0| 54 45 2e 68 22 0d 23 65 | 6e 64 69 66 20 2f 2f 20 |TE.h".#e|ndif // |
|00000900| 71 49 6e 6c 69 6e 65 0d | 23 65 6e 64 69 66 20 2f |qInline.|#endif /|
|00000910| 2f 20 71 41 70 70 6c 65 | 45 76 65 6e 74 73 0d 0d |/ qApple|Events..|
|00000920| 23 69 6e 63 6c 75 64 65 | 20 22 49 6e 6c 69 6e 65 |#include| "Inline|
|00000930| 49 6e 70 75 74 53 61 6d | 70 6c 65 2e 68 22 0d 0d |InputSam|ple.h"..|
|00000940| 0d 2f 2f 20 43 6f 6e 73 | 74 61 6e 74 73 0d 0d 2f |.// Cons|tants../|
|00000950| 2f 20 74 6f 70 20 6c 65 | 66 74 20 63 6f 72 6e 65 |/ top le|ft corne|
|00000960| 72 20 6f 66 20 74 68 65 | 20 64 69 73 6b 20 69 6e |r of the| disk in|
|00000970| 69 74 69 61 6c 69 7a 61 | 74 69 6f 6e 20 64 69 61 |itializa|tion dia|
|00000980| 6c 6f 67 0d 0d 63 6f 6e | 73 74 20 73 68 6f 72 74 |log..con|st short|
|00000990| 20 6b 44 49 54 6f 70 20 | 3d 20 38 30 3b 0d 63 6f | kDITop |= 80;.co|
|000009a0| 6e 73 74 20 73 68 6f 72 | 74 20 6b 44 49 4c 65 66 |nst shor|t kDILef|
|000009b0| 74 20 3d 20 31 31 32 3b | 0d 0d 2f 2f 20 74 68 65 |t = 112;|..// the|
|000009c0| 20 6e 75 6d 62 65 72 20 | 6f 66 20 70 69 78 65 6c | number |of pixel|
|000009d0| 73 20 77 65 20 6c 65 61 | 76 65 20 62 6c 61 6e 6b |s we lea|ve blank|
|000009e0| 20 61 74 20 74 68 65 20 | 65 64 67 65 20 6f 66 20 | at the |edge of |
|000009f0| 74 68 65 20 77 69 6e 64 | 6f 77 0d 0d 63 6f 6e 73 |the wind|ow..cons|
|00000a00| 74 20 73 68 6f 72 74 20 | 6b 54 65 78 74 4d 61 72 |t short |kTextMar|
|00000a10| 67 69 6e 20 3d 20 32 3b | 0d 0d 2f 2f 20 74 68 65 |gin = 2;|..// the|
|00000a20| 20 6d 61 78 69 6d 75 6d | 20 6e 75 6d 62 65 72 20 | maximum| number |
|00000a30| 6f 66 20 6f 70 65 6e 20 | 64 6f 63 75 6d 65 6e 74 |of open |document|
|00000a40| 73 20 61 74 20 61 6e 79 | 20 6f 6e 65 20 74 69 6d |s at any| one tim|
|00000a50| 65 2e 20 53 65 74 75 70 | 4d 65 6e 75 73 20 72 65 |e. Setup|Menus re|
|00000a60| 73 70 65 63 74 73 20 74 | 68 69 73 0d 2f 2f 20 6e |spects t|his.// n|
|00000a70| 75 6d 62 65 72 2c 20 62 | 75 74 20 74 68 65 20 41 |umber, b|ut the A|
|00000a80| 70 70 6c 65 20 65 76 65 | 6e 74 20 68 61 6e 64 6c |pple eve|nt handl|
|00000a90| 65 72 73 20 64 6f 6e 27 | 74 2e 0d 0d 63 6f 6e 73 |ers don'|t...cons|
|00000aa0| 74 20 73 68 6f 72 74 20 | 6b 4d 61 78 4f 70 65 6e |t short |kMaxOpen|
|00000ab0| 44 6f 63 75 6d 65 6e 74 | 73 20 3d 20 34 3b 0d 09 |Document|s = 4;..|
|00000ac0| 0d 2f 2f 20 61 72 62 69 | 74 72 61 72 79 20 6e 75 |.// arbi|trary nu|
|00000ad0| 6d 62 65 72 20 75 73 65 | 64 20 74 6f 20 73 70 65 |mber use|d to spe|
|00000ae0| 63 69 66 79 20 74 68 65 | 20 77 69 64 74 68 20 6f |cify the| width o|
|00000af0| 66 20 74 68 65 20 54 45 | 52 65 63 27 73 20 64 65 |f the TE|Rec's de|
|00000b00| 73 74 69 6e 61 74 69 6f | 6e 0d 2f 2f 20 72 65 63 |stinatio|n.// rec|
|00000b10| 74 61 6e 67 6c 65 20 73 | 6f 20 74 68 61 74 20 77 |tangle s|o that w|
|00000b20| 6f 72 64 20 77 72 61 70 | 20 61 6e 64 20 68 6f 72 |ord wrap| and hor|
|00000b30| 69 7a 6f 6e 74 61 6c 20 | 73 63 72 6f 6c 6c 69 6e |izontal |scrollin|
|00000b40| 67 20 63 61 6e 20 62 65 | 20 64 65 6d 6f 6e 73 74 |g can be| demonst|
|00000b50| 72 61 74 65 64 0d 0d 63 | 6f 6e 73 74 20 73 68 6f |rated..c|onst sho|
|00000b60| 72 74 20 6b 4d 61 78 44 | 6f 63 57 69 64 74 68 20 |rt kMaxD|ocWidth |
|00000b70| 3d 20 35 37 36 3b 0d 09 | 0d 2f 2f 20 74 68 65 20 |= 576;..|.// the |
|00000b80| 6d 69 6e 69 6d 75 6d 20 | 64 69 6d 65 6e 73 69 6f |minimum |dimensio|
|00000b90| 6e 20 6f 66 20 61 20 77 | 69 6e 64 6f 77 20 66 6f |n of a w|indow fo|
|00000ba0| 72 20 47 72 6f 77 57 69 | 6e 64 6f 77 0d 0d 63 6f |r GrowWi|ndow..co|
|00000bb0| 6e 73 74 20 73 68 6f 72 | 74 20 6b 4d 69 6e 44 6f |nst shor|t kMinDo|
|00000bc0| 63 44 69 6d 20 3d 20 36 | 34 3b 0d 0d 2f 2f 20 63 |cDim = 6|4;..// c|
|00000bd0| 6f 6e 74 72 6f 6c 20 63 | 6f 6e 74 72 6c 56 69 73 |ontrol c|ontrlVis|
|00000be0| 20 76 61 6c 75 65 73 20 | 74 6f 20 70 72 65 76 65 | values |to preve|
|00000bf0| 6e 74 20 6f 72 20 65 6e | 61 62 6c 65 20 72 65 64 |nt or en|able red|
|00000c00| 72 61 77 69 6e 67 20 63 | 6f 6e 74 72 6f 6c 73 20 |rawing c|ontrols |
|00000c10| 62 79 0d 2f 2f 20 43 6f | 6e 74 72 6f 6c 20 4d 61 |by.// Co|ntrol Ma|
|00000c20| 6e 61 67 65 72 20 72 6f | 75 74 69 6e 65 73 20 73 |nager ro|utines s|
|00000c30| 75 63 68 20 61 73 20 53 | 65 74 43 74 6c 56 61 6c |uch as S|etCtlVal|
|00000c40| 75 65 0d 0d 63 6f 6e 73 | 74 20 75 6e 73 69 67 6e |ue..cons|t unsign|
|00000c50| 65 64 20 63 68 61 72 20 | 6b 43 6f 6e 74 72 6f 6c |ed char |kControl|
|00000c60| 49 6e 76 69 73 69 62 6c | 65 20 3d 20 30 3b 0d 63 |Invisibl|e = 0;.c|
|00000c70| 6f 6e 73 74 20 75 6e 73 | 69 67 6e 65 64 20 63 68 |onst uns|igned ch|
|00000c80| 61 72 20 6b 43 6f 6e 74 | 72 6f 6c 56 69 73 69 62 |ar kCont|rolVisib|
|00000c90| 6c 65 20 3d 20 30 78 66 | 66 3b 0d 0d 2f 2f 20 66 |le = 0xf|f;..// f|
|00000ca0| 6f 72 20 63 61 6c 63 75 | 6c 61 74 69 6e 67 20 73 |or calcu|lating s|
|00000cb0| 63 72 6f 6c 6c 20 62 61 | 72 20 70 6f 73 69 74 69 |croll ba|r positi|
|00000cc0| 6f 6e 73 20 61 6e 64 20 | 73 69 7a 65 73 0d 0d 63 |ons and |sizes..c|
|00000cd0| 6f 6e 73 74 20 73 68 6f | 72 74 20 6b 53 63 72 6f |onst sho|rt kScro|
|00000ce0| 6c 6c 62 61 72 57 69 64 | 74 68 20 3d 20 31 36 3b |llbarWid|th = 16;|
|00000cf0| 0d 63 6f 6e 73 74 20 73 | 68 6f 72 74 20 6b 53 63 |.const s|hort kSc|
|00000d00| 72 6f 6c 6c 62 61 72 41 | 64 6a 75 73 74 20 3d 20 |rollbarA|djust = |
|00000d10| 31 35 3b 20 2f 2f 20 73 | 68 6f 75 6c 64 20 62 65 |15; // s|hould be|
|00000d20| 20 6b 53 63 72 6f 6c 6c | 62 61 72 57 69 64 74 68 | kScroll|barWidth|
|00000d30| 20 2d 20 31 2c 20 62 75 | 74 20 43 20 69 73 20 74 | - 1, bu|t C is t|
|00000d40| 6f 6f 20 73 74 75 70 69 | 64 0d 63 6f 6e 73 74 20 |oo stupi|d.const |
|00000d50| 73 68 6f 72 74 20 6b 53 | 63 72 6f 6c 6c 54 77 65 |short kS|crollTwe|
|00000d60| 65 6b 20 3d 20 32 3b 0d | 09 0d 2f 2f 20 41 53 43 |ek = 2;.|..// ASC|
|00000d70| 49 49 20 63 6f 64 65 20 | 66 6f 72 20 64 65 6c 65 |II code |for dele|
|00000d80| 74 65 20 63 68 61 72 61 | 63 74 65 72 0d 0d 63 6f |te chara|cter..co|
|00000d90| 6e 73 74 20 75 6e 73 69 | 67 6e 65 64 20 63 68 61 |nst unsi|gned cha|
|00000da0| 72 20 6b 44 65 6c 43 68 | 61 72 20 3d 20 38 3b 0d |r kDelCh|ar = 8;.|
|00000db0| 09 0d 2f 2f 20 70 69 78 | 65 6c 73 20 74 6f 20 73 |..// pix|els to s|
|00000dc0| 63 72 6f 6c 6c 20 77 68 | 65 6e 20 74 68 65 20 62 |croll wh|en the b|
|00000dd0| 75 74 74 6f 6e 20 70 61 | 72 74 20 6f 66 20 74 68 |utton pa|rt of th|
|00000de0| 65 20 68 6f 72 69 7a 6f | 6e 74 61 6c 20 73 63 72 |e horizo|ntal scr|
|00000df0| 6f 6c 6c 62 61 72 20 69 | 73 20 70 72 65 73 73 65 |ollbar i|s presse|
|00000e00| 64 0d 0d 63 6f 6e 73 74 | 20 73 68 6f 72 74 20 6b |d..const| short k|
|00000e10| 42 75 74 74 6f 6e 53 63 | 72 6f 6c 6c 20 3d 20 34 |ButtonSc|roll = 4|
|00000e20| 3b 0d 0d 2f 2f 20 6d 61 | 78 69 6d 75 6d 20 74 65 |;..// ma|ximum te|
|00000e30| 78 74 20 6c 65 6e 67 74 | 68 20 77 65 20 61 6c 6c |xt lengt|h we all|
|00000e40| 6f 77 20 69 6e 20 61 20 | 54 45 52 65 63 3b 20 6c |ow in a |TERec; l|
|00000e50| 6f 77 65 72 20 74 68 61 | 6e 20 33 32 37 36 37 20 |ower tha|n 32767 |
|00000e60| 74 6f 20 70 72 65 76 65 | 6e 74 20 65 72 72 6f 72 |to preve|nt error|
|00000e70| 73 0d 0d 63 6f 6e 73 74 | 20 73 68 6f 72 74 20 6b |s..const| short k|
|00000e80| 4d 61 78 54 45 4c 65 6e | 67 74 68 20 3d 20 33 32 |MaxTELen|gth = 32|
|00000e90| 30 30 30 3b 0d 0d 2f 2f | 20 74 68 65 20 53 79 73 |000;..//| the Sys|
|00000ea0| 45 6e 76 52 65 63 20 76 | 65 72 73 69 6f 6e 20 77 |EnvRec v|ersion w|
|00000eb0| 65 20 75 6e 64 65 72 73 | 74 61 6e 64 0d 0d 63 6f |e unders|tand..co|
|00000ec0| 6e 73 74 20 73 68 6f 72 | 74 20 6b 53 79 73 45 6e |nst shor|t kSysEn|
|00000ed0| 76 69 72 6f 6e 73 56 65 | 72 73 69 6f 6e 20 3d 20 |vironsVe|rsion = |
|00000ee0| 31 3b 0d 0d 2f 2f 20 65 | 76 65 6e 74 73 20 6d 61 |1;..// e|vents ma|
|00000ef0| 73 6b 20 66 6f 72 20 6e | 6f 20 65 76 65 6e 74 73 |sk for n|o events|
|00000f00| 0d 0d 63 6f 6e 73 74 20 | 73 68 6f 72 74 20 6b 4e |..const |short kN|
|00000f10| 6f 45 76 65 6e 74 73 4d | 61 73 6b 20 3d 20 30 3b |oEventsM|ask = 0;|
|00000f20| 0d 0d 2f 2f 20 74 68 65 | 20 6d 69 6e 69 6d 75 6d |..// the| minimum|
|00000f30| 20 68 65 61 70 20 73 69 | 7a 65 20 61 6e 64 20 6d | heap si|ze and m|
|00000f40| 69 6e 69 6d 61 6c 20 61 | 76 61 69 6c 61 62 6c 65 |inimal a|vailable|
|00000f50| 20 68 65 61 70 20 73 70 | 61 63 65 20 77 65 20 72 | heap sp|ace we r|
|00000f60| 65 71 75 69 72 65 20 66 | 6f 72 20 72 75 6e 6e 69 |equire f|or runni|
|00000f70| 6e 67 2e 0d 2f 2f 20 54 | 68 65 73 65 20 61 72 65 |ng..// T|hese are|
|00000f80| 20 72 6f 75 67 68 20 67 | 75 65 73 73 65 73 3b 20 | rough g|uesses; |
|00000f90| 77 69 74 68 20 73 74 79 | 6c 65 64 20 54 65 78 74 |with sty|led Text|
|00000fa0| 45 64 69 74 20 61 6e 64 | 20 70 72 69 6e 74 69 6e |Edit and| printin|
|00000fb0| 67 20 79 6f 75 20 6e 65 | 76 65 72 20 72 65 61 6c |g you ne|ver real|
|00000fc0| 6c 79 20 6b 6e 6f 77 2e | 0d 0d 63 6f 6e 73 74 20 |ly know.|..const |
|00000fd0| 53 69 7a 65 20 6b 4d 69 | 6e 48 65 61 70 20 3d 20 |Size kMi|nHeap = |
|00000fe0| 35 30 20 2a 20 31 30 32 | 34 3b 0d 63 6f 6e 73 74 |50 * 102|4;.const|
|00000ff0| 20 53 69 7a 65 20 6b 4d | 69 6e 53 70 61 63 65 20 | Size kM|inSpace |
|00001000| 3d 20 34 30 20 2a 20 31 | 30 32 34 3b 0d 0d 2f 2f |= 40 * 1|024;..//|
|00001010| 20 76 61 6c 75 65 73 20 | 66 6f 72 20 73 65 74 74 | values |for sett|
|00001020| 69 6e 67 20 75 70 20 77 | 69 64 65 20 6f 70 65 6e |ing up w|ide open|
|00001030| 20 72 65 63 74 61 6e 67 | 6c 65 73 20 61 6e 64 20 | rectang|les and |
|00001040| 72 65 67 69 6f 6e 73 0d | 0d 63 6f 6e 73 74 20 73 |regions.|.const s|
|00001050| 68 6f 72 74 20 6b 45 78 | 74 72 65 6d 65 4e 65 67 |hort kEx|tremeNeg|
|00001060| 20 3d 20 2d 33 32 37 36 | 38 3b 0d 63 6f 6e 73 74 | = -3276|8;.const|
|00001070| 20 73 68 6f 72 74 20 6b | 45 78 74 72 65 6d 65 50 | short k|ExtremeP|
|00001080| 6f 73 20 3d 20 33 32 37 | 36 37 20 2d 31 3b 20 2f |os = 327|67 -1; /|
|00001090| 2f 20 72 65 71 75 69 72 | 65 64 20 74 6f 20 61 64 |/ requir|ed to ad|
|000010a0| 64 72 65 73 73 20 61 6e | 20 6f 6c 64 20 72 65 67 |dress an| old reg|
|000010b0| 69 6f 6e 20 62 75 67 0d | 0d 2f 2f 20 65 78 74 72 |ion bug.|.// extr|
|000010c0| 61 20 73 65 63 75 72 69 | 74 79 20 77 68 65 6e 20 |a securi|ty when |
|000010d0| 70 72 65 2d 66 6c 69 67 | 68 74 69 6e 67 20 65 64 |pre-flig|hting ed|
|000010e0| 69 74 20 63 6f 6d 6d 61 | 6e 64 73 0d 0d 63 6f 6e |it comma|nds..con|
|000010f0| 73 74 20 73 68 6f 72 74 | 20 6b 54 45 53 6c 6f 70 |st short| kTESlop|
|00001100| 20 3d 20 31 30 32 34 3b | 0d 0d 0d 2f 2f 20 54 79 | = 1024;|...// Ty|
|00001110| 70 65 73 0d 0d 2f 2f 20 | 41 20 44 6f 63 75 6d 65 |pes..// |A Docume|
|00001120| 6e 74 52 65 63 6f 72 64 | 20 63 6f 6e 74 61 69 6e |ntRecord| contain|
|00001130| 73 20 74 68 65 20 57 69 | 6e 64 6f 77 52 65 63 6f |s the Wi|ndowReco|
|00001140| 72 64 20 66 6f 72 20 6f | 6e 65 20 6f 66 20 6f 75 |rd for o|ne of ou|
|00001150| 72 20 64 6f 63 75 6d 65 | 6e 74 20 77 69 6e 64 6f |r docume|nt windo|
|00001160| 77 73 2c 0d 2f 2f 20 61 | 73 20 77 65 6c 6c 20 61 |ws,.// a|s well a|
|00001170| 73 20 74 68 65 20 54 45 | 48 61 6e 64 6c 65 20 66 |s the TE|Handle f|
|00001180| 6f 72 20 74 68 65 20 74 | 65 78 74 20 77 65 20 61 |or the t|ext we a|
|00001190| 72 65 20 65 64 69 74 69 | 6e 67 2e 20 4f 74 68 65 |re editi|ng. Othe|
|000011a0| 72 20 64 6f 63 75 6d 65 | 6e 74 20 66 69 65 6c 64 |r docume|nt field|
|000011b0| 73 0d 2f 2f 20 63 61 6e | 20 62 65 20 61 64 64 65 |s.// can| be adde|
|000011c0| 64 20 74 6f 20 74 68 69 | 73 20 72 65 63 6f 72 64 |d to thi|s record|
|000011d0| 20 61 73 20 6e 65 65 64 | 65 64 2e 20 54 68 69 73 | as need|ed. This|
|000011e0| 20 69 73 20 73 69 6d 69 | 6c 61 72 20 74 6f 20 68 | is simi|lar to h|
|000011f0| 6f 77 20 74 68 65 0d 2f | 2f 20 57 69 6e 64 6f 77 |ow the./|/ Window|
|00001200| 20 4d 61 6e 61 67 65 72 | 20 61 6e 64 20 44 69 61 | Manager| and Dia|
|00001210| 6c 6f 67 20 4d 61 6e 61 | 67 65 72 20 61 64 64 20 |log Mana|ger add |
|00001220| 66 69 65 6c 64 73 20 61 | 66 74 65 72 20 74 68 65 |fields a|fter the|
|00001230| 20 47 72 61 66 50 6f 72 | 74 2e 0d 0d 74 79 70 65 | GrafPor|t...type|
|00001240| 64 65 66 20 73 74 72 75 | 63 74 20 7b 0d 09 57 69 |def stru|ct {..Wi|
|00001250| 6e 64 6f 77 52 65 63 6f | 72 64 09 64 6f 63 57 69 |ndowReco|rd.docWi|
|00001260| 6e 64 6f 77 3b 0d 09 54 | 45 48 61 6e 64 6c 65 09 |ndow;..T|EHandle.|
|00001270| 09 64 6f 63 54 45 3b 0d | 09 43 6f 6e 74 72 6f 6c |.docTE;.|.Control|
|00001280| 48 61 6e 64 6c 65 09 64 | 6f 63 56 53 63 72 6f 6c |Handle.d|ocVScrol|
|00001290| 6c 3b 0d 09 43 6f 6e 74 | 72 6f 6c 48 61 6e 64 6c |l;..Cont|rolHandl|
|000012a0| 65 09 64 6f 63 48 53 63 | 72 6f 6c 6c 3b 0d 09 54 |e.docHSc|roll;..T|
|000012b0| 45 43 6c 69 63 6b 4c 6f | 6f 70 55 50 50 09 64 6f |EClickLo|opUPP.do|
|000012c0| 63 43 6c 69 63 6b 3b 0d | 09 42 6f 6f 6c 65 61 6e |cClick;.|.Boolean|
|000012d0| 09 09 09 6d 6f 64 69 66 | 69 65 64 3b 0d 23 69 66 |...modif|ied;.#if|
|000012e0| 20 71 49 6e 6c 69 6e 65 | 0d 09 54 53 4d 54 45 52 | qInline|..TSMTER|
|000012f0| 65 63 48 61 6e 64 6c 65 | 09 64 6f 63 54 53 4d 54 |ecHandle|.docTSMT|
|00001300| 45 52 65 63 48 61 6e 64 | 6c 65 3b 0d 09 54 53 4d |ERecHand|le;..TSM|
|00001310| 44 6f 63 75 6d 65 6e 74 | 49 44 09 64 6f 63 54 53 |Document|ID.docTS|
|00001320| 4d 44 6f 63 3b 0d 23 65 | 6e 64 69 66 0d 7d 20 44 |MDoc;.#e|ndif.} D|
|00001330| 6f 63 75 6d 65 6e 74 52 | 65 63 6f 72 64 2c 20 2a |ocumentR|ecord, *|
|00001340| 44 6f 63 75 6d 65 6e 74 | 50 65 65 6b 3b 0d 0d 0d |Document|Peek;...|
|00001350| 2f 2f 20 47 6c 6f 62 61 | 6c 20 56 61 72 69 61 62 |// Globa|l Variab|
|00001360| 6c 65 73 0d 0d 2f 2f 20 | 65 6e 76 69 72 6f 6e 6d |les..// |environm|
|00001370| 65 6e 74 20 69 6e 66 6f | 72 6d 61 74 69 6f 6e 20 |ent info|rmation |
|00001380| 74 68 61 74 27 73 20 73 | 65 74 20 75 70 20 64 75 |that's s|et up du|
|00001390| 72 69 6e 67 20 69 6e 69 | 74 69 61 6c 69 7a 61 74 |ring ini|tializat|
|000013a0| 69 6f 6e 0d 0d 42 6f 6f | 6c 65 61 6e 20 67 48 61 |ion..Boo|lean gHa|
|000013b0| 73 57 61 69 74 4e 65 78 | 74 45 76 65 6e 74 3b 09 |sWaitNex|tEvent;.|
|000013c0| 09 2f 2f 20 57 61 69 74 | 4e 65 78 74 45 76 65 6e |.// Wait|NextEven|
|000013d0| 74 20 74 72 61 70 20 69 | 73 20 61 76 61 69 6c 61 |t trap i|s availa|
|000013e0| 62 6c 65 0d 23 69 66 20 | 71 41 70 70 6c 65 45 76 |ble.#if |qAppleEv|
|000013f0| 65 6e 74 73 0d 42 6f 6f | 6c 65 61 6e 20 67 48 61 |ents.Boo|lean gHa|
|00001400| 73 41 70 70 6c 65 45 76 | 65 6e 74 73 3b 09 09 2f |sAppleEv|ents;../|
|00001410| 2f 20 41 70 70 6c 65 20 | 65 76 65 6e 74 73 20 61 |/ Apple |events a|
|00001420| 72 65 20 61 76 61 69 6c | 61 62 6c 65 2c 20 73 6f |re avail|able, so|
|00001430| 20 77 65 20 65 78 70 65 | 63 74 20 74 6f 20 67 65 | we expe|ct to ge|
|00001440| 74 20 65 76 65 6e 74 73 | 20 66 72 6f 6d 20 74 68 |t events| from th|
|00001450| 65 20 46 69 6e 64 65 72 | 0d 23 69 66 20 71 49 6e |e Finder|.#if qIn|
|00001460| 6c 69 6e 65 0d 42 6f 6f | 6c 65 61 6e 20 67 48 61 |line.Boo|lean gHa|
|00001470| 73 54 65 78 74 53 65 72 | 76 69 63 65 73 3b 09 09 |sTextSer|vices;..|
|00001480| 2f 2f 20 54 65 78 74 20 | 53 65 72 76 69 63 65 73 |// Text |Services|
|00001490| 20 4d 61 6e 61 67 65 72 | 20 69 73 20 61 76 61 69 | Manager| is avai|
|000014a0| 6c 61 62 6c 65 20 61 6e | 64 20 73 68 6f 75 6c 64 |lable an|d should|
|000014b0| 20 62 65 20 75 73 65 64 | 0d 42 6f 6f 6c 65 61 6e | be used|.Boolean|
|000014c0| 20 67 48 61 73 54 53 4d | 54 45 3b 09 09 09 09 2f | gHasTSM|TE;..../|
|000014d0| 2f 20 54 65 78 74 20 53 | 65 72 76 69 63 65 73 20 |/ Text S|ervices |
|000014e0| 66 6f 72 20 54 65 78 74 | 20 45 64 69 74 20 61 72 |for Text| Edit ar|
|000014f0| 65 20 61 76 61 69 6c 61 | 62 6c 65 20 61 6e 64 20 |e availa|ble and |
|00001500| 73 68 6f 75 6c 64 20 62 | 65 20 75 73 65 64 0d 09 |should b|e used..|
|00001510| 09 09 09 09 09 09 09 2f | 2f 20 67 48 61 73 54 53 |......./|/ gHasTS|
|00001520| 4d 54 45 20 63 61 6e 20 | 6f 6e 6c 79 20 62 65 20 |MTE can |only be |
|00001530| 73 65 74 20 69 66 20 67 | 48 61 73 54 65 78 74 53 |set if g|HasTextS|
|00001540| 65 72 76 69 63 65 73 2e | 0d 23 65 6e 64 69 66 20 |ervices.|.#endif |
|00001550| 2f 2f 20 71 49 6e 6c 69 | 6e 65 0d 23 65 6e 64 69 |// qInli|ne.#endi|
|00001560| 66 20 2f 2f 20 71 41 70 | 70 6c 65 45 76 65 6e 74 |f // qAp|pleEvent|
|00001570| 73 0d 0d 2f 2f 20 77 68 | 65 74 68 65 72 20 77 65 |s..// wh|ether we|
|00001580| 20 61 72 65 20 63 75 72 | 72 65 6e 74 6c 79 20 69 | are cur|rently i|
|00001590| 6e 20 74 68 65 20 62 61 | 63 6b 67 72 6f 75 6e 64 |n the ba|ckground|
|000015a0| 2e 20 54 68 69 73 20 61 | 63 63 6f 75 6e 74 73 20 |. This a|ccounts |
|000015b0| 66 6f 72 20 6d 61 6a 6f | 72 20 73 77 69 74 63 68 |for majo|r switch|
|000015c0| 65 73 20 6f 6e 6c 79 2e | 0d 0d 42 6f 6f 6c 65 61 |es only.|..Boolea|
|000015d0| 6e 20 67 49 6e 42 61 63 | 6b 67 72 6f 75 6e 64 3b |n gInBac|kground;|
|000015e0| 0d 0d 2f 2f 20 74 68 65 | 20 6e 75 6d 62 65 72 20 |..// the| number |
|000015f0| 6f 66 20 64 6f 63 75 6d | 65 6e 74 73 20 63 75 72 |of docum|ents cur|
|00001600| 72 65 6e 74 6c 79 20 6f | 70 65 6e 0d 0d 73 68 6f |rently o|pen..sho|
|00001610| 72 74 20 67 4e 75 6d 44 | 6f 63 75 6d 65 6e 74 73 |rt gNumD|ocuments|
|00001620| 3b 0d 0d 2f 2f 20 70 72 | 69 6e 74 20 72 65 63 6f |;..// pr|int reco|
|00001630| 72 64 20 73 68 61 72 65 | 64 20 61 6d 6f 6e 67 20 |rd share|d among |
|00001640| 61 6c 6c 20 64 6f 63 75 | 6d 65 6e 74 73 20 3f 3f |all docu|ments ??|
|00001650| 3f 20 70 72 6f 62 61 62 | 6c 79 20 73 68 6f 75 6c |? probab|ly shoul|
|00001660| 64 20 62 65 20 61 74 74 | 61 63 68 65 64 20 74 6f |d be att|ached to|
|00001670| 20 64 6f 63 75 6d 65 6e | 74 73 20 69 6e 73 74 65 | documen|ts inste|
|00001680| 61 64 0d 0d 54 48 50 72 | 69 6e 74 20 67 50 72 69 |ad..THPr|int gPri|
|00001690| 6e 74 65 72 52 65 63 6f | 72 64 3b 0d 0d 2f 2f 20 |nterReco|rd;..// |
|000016a0| 75 6e 69 76 65 72 73 61 | 6c 20 70 72 6f 63 65 64 |universa|l proced|
|000016b0| 75 72 65 20 70 6f 69 6e | 74 65 72 73 0d 0d 43 6f |ure poin|ters..Co|
|000016c0| 6e 74 72 6f 6c 41 63 74 | 69 6f 6e 55 50 50 20 67 |ntrolAct|ionUPP g|
|000016d0| 48 41 63 74 69 6f 6e 55 | 50 50 3b 0d 43 6f 6e 74 |HActionU|PP;.Cont|
|000016e0| 72 6f 6c 41 63 74 69 6f | 6e 55 50 50 20 67 56 41 |rolActio|nUPP gVA|
|000016f0| 63 74 69 6f 6e 55 50 50 | 3b 0d 23 69 66 20 70 6f |ctionUPP|;.#if po|
|00001700| 77 65 72 63 0d 54 45 43 | 6c 69 63 6b 4c 6f 6f 70 |werc.TEC|lickLoop|
|00001710| 55 50 50 20 67 43 6c 69 | 63 6b 4c 6f 6f 70 55 50 |UPP gCli|ckLoopUP|
|00001720| 50 3b 0d 23 65 6e 64 69 | 66 0d 23 69 66 20 71 41 |P;.#endi|f.#if qA|
|00001730| 70 70 6c 65 45 76 65 6e | 74 73 0d 41 45 45 76 65 |ppleEven|ts.AEEve|
|00001740| 6e 74 48 61 6e 64 6c 65 | 72 55 50 50 20 67 48 61 |ntHandle|rUPP gHa|
|00001750| 6e 64 6c 65 4f 41 70 70 | 55 50 50 3b 0d 41 45 45 |ndleOApp|UPP;.AEE|
|00001760| 76 65 6e 74 48 61 6e 64 | 6c 65 72 55 50 50 20 67 |ventHand|lerUPP g|
|00001770| 48 61 6e 64 6c 65 44 6f | 63 55 50 50 3b 0d 41 45 |HandleDo|cUPP;.AE|
|00001780| 45 76 65 6e 74 48 61 6e | 64 6c 65 72 55 50 50 20 |EventHan|dlerUPP |
|00001790| 67 48 61 6e 64 6c 65 51 | 75 69 74 55 50 50 3b 0d |gHandleQ|uitUPP;.|
|000017a0| 23 69 66 20 71 49 6e 6c | 69 6e 65 0d 54 53 4d 54 |#if qInl|ine.TSMT|
|000017b0| 45 50 72 65 55 70 64 61 | 74 65 55 50 50 20 67 54 |EPreUpda|teUPP gT|
|000017c0| 53 4d 54 45 50 72 65 55 | 70 64 61 74 65 55 50 50 |SMTEPreU|pdateUPP|
|000017d0| 3b 0d 54 53 4d 54 45 50 | 6f 73 74 55 70 64 61 74 |;.TSMTEP|ostUpdat|
|000017e0| 65 55 50 50 20 67 54 53 | 4d 54 45 50 6f 73 74 55 |eUPP gTS|MTEPostU|
|000017f0| 70 64 61 74 65 55 50 50 | 3b 0d 23 65 6e 64 69 66 |pdateUPP|;.#endif|
|00001800| 20 2f 2f 20 71 49 6e 6c | 69 6e 65 0d 23 65 6e 64 | // qInl|ine.#end|
|00001810| 69 66 20 2f 2f 20 71 41 | 70 70 6c 65 45 76 65 6e |if // qA|ppleEven|
|00001820| 74 73 0d 0d 23 69 66 20 | 70 6f 77 65 72 63 20 26 |ts..#if |powerc &|
|00001830| 20 21 5f 5f 4d 57 45 52 | 4b 53 5f 5f 0d 2f 2f 20 | !__MWER|KS__.// |
|00001840| 50 6f 77 65 72 50 43 20 | 6c 69 62 72 61 72 69 65 |PowerPC |librarie|
|00001850| 73 20 64 6f 6e 27 74 20 | 61 75 74 6f 6d 61 74 69 |s don't |automati|
|00001860| 63 61 6c 6c 79 20 64 65 | 66 69 6e 65 20 51 75 69 |cally de|fine Qui|
|00001870| 63 6b 44 72 61 77 20 67 | 6c 6f 62 61 6c 73 0d 0d |ckDraw g|lobals..|
|00001880| 51 44 47 6c 6f 62 61 6c | 73 20 71 64 3b 0d 23 65 |QDGlobal|s qd;.#e|
|00001890| 6e 64 69 66 0d 0d 23 69 | 66 20 71 41 70 70 6c 65 |ndif..#i|f qApple|
|000018a0| 45 76 65 6e 74 73 0d 2f | 2f 20 74 6f 20 69 6e 64 |Events./|/ to ind|
|000018b0| 69 63 61 74 65 20 74 68 | 61 74 20 51 75 69 74 20 |icate th|at Quit |
|000018c0| 63 6f 6d 6d 61 6e 64 20 | 6f 72 20 41 70 70 6c 65 |command |or Apple|
|000018d0| 20 65 76 65 6e 74 20 77 | 61 73 20 73 75 63 63 65 | event w|as succe|
|000018e0| 73 73 66 75 6c 0d 0d 42 | 6f 6f 6c 65 61 6e 20 67 |ssful..B|oolean g|
|000018f0| 51 75 69 74 74 69 6e 67 | 3b 0d 0d 23 69 66 20 71 |Quitting|;..#if q|
|00001900| 49 6e 6c 69 6e 65 0d 2f | 2f 20 76 61 72 69 61 62 |Inline./|/ variab|
|00001910| 6c 65 20 74 6f 20 6b 65 | 65 70 20 6f 75 74 73 69 |le to ke|ep outsi|
|00001920| 64 65 20 66 6f 6e 74 46 | 6f 72 63 65 20 69 6e 66 |de fontF|orce inf|
|00001930| 6f 72 6d 61 74 69 6f 6e | 0d 0d 6c 6f 6e 67 20 67 |ormation|..long g|
|00001940| 53 61 76 65 64 46 6f 6e | 74 46 6f 72 63 65 3b 0d |SavedFon|tForce;.|
|00001950| 0d 23 65 6e 64 69 66 20 | 2f 2f 20 71 49 6e 6c 69 |.#endif |// qInli|
|00001960| 6e 65 0d 23 65 6e 64 69 | 66 20 2f 2f 20 71 41 70 |ne.#endi|f // qAp|
|00001970| 70 6c 65 45 76 65 6e 74 | 73 0d 0d 0d 2f 2f 20 52 |pleEvent|s...// R|
|00001980| 6f 75 74 69 6e 65 20 44 | 65 63 6c 61 72 61 74 69 |outine D|eclarati|
|00001990| 6f 6e 73 0d 0d 76 6f 69 | 64 20 41 6c 65 72 74 55 |ons..voi|d AlertU|
|000019a0| 73 65 72 28 73 68 6f 72 | 74 20 65 72 72 6f 72 29 |ser(shor|t error)|
|000019b0| 3b 0d 76 6f 69 64 20 45 | 76 65 6e 74 4c 6f 6f 70 |;.void E|ventLoop|
|000019c0| 28 76 6f 69 64 29 3b 0d | 76 6f 69 64 20 44 6f 45 |(void);.|void DoE|
|000019d0| 76 65 6e 74 28 45 76 65 | 6e 74 52 65 63 6f 72 64 |vent(Eve|ntRecord|
|000019e0| 20 2a 65 76 65 6e 74 29 | 3b 0d 76 6f 69 64 20 41 | *event)|;.void A|
|000019f0| 64 6a 75 73 74 43 75 72 | 73 6f 72 28 50 6f 69 6e |djustCur|sor(Poin|
|00001a00| 74 20 6d 6f 75 73 65 2c | 20 52 67 6e 48 61 6e 64 |t mouse,| RgnHand|
|00001a10| 6c 65 20 72 65 67 69 6f | 6e 29 3b 0d 76 6f 69 64 |le regio|n);.void|
|00001a20| 20 47 65 74 47 6c 6f 62 | 61 6c 4d 6f 75 73 65 28 | GetGlob|alMouse(|
|00001a30| 50 6f 69 6e 74 20 2a 6d | 6f 75 73 65 29 3b 0d 76 |Point *m|ouse);.v|
|00001a40| 6f 69 64 20 44 6f 47 72 | 6f 77 57 69 6e 64 6f 77 |oid DoGr|owWindow|
|00001a50| 28 57 69 6e 64 6f 77 50 | 74 72 20 77 69 6e 64 6f |(WindowP|tr windo|
|00001a60| 77 2c 20 45 76 65 6e 74 | 52 65 63 6f 72 64 20 2a |w, Event|Record *|
|00001a70| 65 76 65 6e 74 29 3b 0d | 76 6f 69 64 20 44 6f 5a |event);.|void DoZ|
|00001a80| 6f 6f 6d 57 69 6e 64 6f | 77 28 57 69 6e 64 6f 77 |oomWindo|w(Window|
|00001a90| 50 74 72 20 77 69 6e 64 | 6f 77 2c 20 73 68 6f 72 |Ptr wind|ow, shor|
|00001aa0| 74 20 70 61 72 74 29 3b | 0d 76 6f 69 64 20 52 65 |t part);|.void Re|
|00001ab0| 73 69 7a 65 57 69 6e 64 | 6f 77 28 57 69 6e 64 6f |sizeWind|ow(Windo|
|00001ac0| 77 50 74 72 20 77 69 6e | 64 6f 77 29 3b 0d 76 6f |wPtr win|dow);.vo|
|00001ad0| 69 64 20 47 65 74 4c 6f | 63 61 6c 55 70 64 61 74 |id GetLo|calUpdat|
|00001ae0| 65 52 67 6e 28 57 69 6e | 64 6f 77 50 74 72 20 77 |eRgn(Win|dowPtr w|
|00001af0| 69 6e 64 6f 77 2c 20 52 | 67 6e 48 61 6e 64 6c 65 |indow, R|gnHandle|
|00001b00| 20 6c 6f 63 61 6c 52 67 | 6e 29 3b 0d 76 6f 69 64 | localRg|n);.void|
|00001b10| 20 44 6f 55 70 64 61 74 | 65 28 57 69 6e 64 6f 77 | DoUpdat|e(Window|
|00001b20| 50 74 72 20 77 69 6e 64 | 6f 77 29 3b 0d 76 6f 69 |Ptr wind|ow);.voi|
|00001b30| 64 20 44 6f 41 63 74 69 | 76 61 74 65 28 57 69 6e |d DoActi|vate(Win|
|00001b40| 64 6f 77 50 74 72 20 77 | 69 6e 64 6f 77 2c 20 42 |dowPtr w|indow, B|
|00001b50| 6f 6f 6c 65 61 6e 20 62 | 65 63 6f 6d 69 6e 67 41 |oolean b|ecomingA|
|00001b60| 63 74 69 76 65 29 3b 0d | 76 6f 69 64 20 44 6f 43 |ctive);.|void DoC|
|00001b70| 6f 6e 74 65 6e 74 43 6c | 69 63 6b 28 57 69 6e 64 |ontentCl|ick(Wind|
|00001b80| 6f 77 50 74 72 20 77 69 | 6e 64 6f 77 2c 20 45 76 |owPtr wi|ndow, Ev|
|00001b90| 65 6e 74 52 65 63 6f 72 | 64 20 2a 65 76 65 6e 74 |entRecor|d *event|
|00001ba0| 29 3b 0d 76 6f 69 64 20 | 44 6f 4b 65 79 44 6f 77 |);.void |DoKeyDow|
|00001bb0| 6e 28 45 76 65 6e 74 52 | 65 63 6f 72 64 20 2a 65 |n(EventR|ecord *e|
|00001bc0| 76 65 6e 74 29 3b 0d 75 | 6e 73 69 67 6e 65 64 20 |vent);.u|nsigned |
|00001bd0| 6c 6f 6e 67 20 47 65 74 | 53 6c 65 65 70 28 76 6f |long Get|Sleep(vo|
|00001be0| 69 64 29 3b 0d 76 6f 69 | 64 20 43 6f 6d 6d 6f 6e |id);.voi|d Common|
|00001bf0| 41 63 74 69 6f 6e 28 43 | 6f 6e 74 72 6f 6c 48 61 |Action(C|ontrolHa|
|00001c00| 6e 64 6c 65 20 63 6f 6e | 74 72 6f 6c 2c 20 73 68 |ndle con|trol, sh|
|00001c10| 6f 72 74 20 2a 61 6d 6f | 75 6e 74 29 3b 0d 70 61 |ort *amo|unt);.pa|
|00001c20| 73 63 61 6c 20 76 6f 69 | 64 20 56 41 63 74 69 6f |scal voi|d VActio|
|00001c30| 6e 50 72 6f 63 28 43 6f | 6e 74 72 6f 6c 48 61 6e |nProc(Co|ntrolHan|
|00001c40| 64 6c 65 20 63 6f 6e 74 | 72 6f 6c 2c 20 73 68 6f |dle cont|rol, sho|
|00001c50| 72 74 20 70 61 72 74 29 | 3b 0d 70 61 73 63 61 6c |rt part)|;.pascal|
|00001c60| 20 76 6f 69 64 20 48 41 | 63 74 69 6f 6e 50 72 6f | void HA|ctionPro|
|00001c70| 63 28 43 6f 6e 74 72 6f | 6c 48 61 6e 64 6c 65 20 |c(Contro|lHandle |
|00001c80| 63 6f 6e 74 72 6f 6c 2c | 20 73 68 6f 72 74 20 70 |control,| short p|
|00001c90| 61 72 74 29 3b 0d 76 6f | 69 64 20 44 6f 49 64 6c |art);.vo|id DoIdl|
|00001ca0| 65 28 76 6f 69 64 29 3b | 0d 76 6f 69 64 20 44 72 |e(void);|.void Dr|
|00001cb0| 61 77 57 69 6e 64 6f 77 | 28 57 69 6e 64 6f 77 50 |awWindow|(WindowP|
|00001cc0| 74 72 20 77 69 6e 64 6f | 77 29 3b 0d 76 6f 69 64 |tr windo|w);.void|
|00001cd0| 20 41 64 6a 75 73 74 4d | 65 6e 75 73 28 76 6f 69 | AdjustM|enus(voi|
|00001ce0| 64 29 3b 0d 76 6f 69 64 | 20 44 6f 4d 65 6e 75 43 |d);.void| DoMenuC|
|00001cf0| 6f 6d 6d 61 6e 64 28 6c | 6f 6e 67 20 6d 65 6e 75 |ommand(l|ong menu|
|00001d00| 52 65 73 75 6c 74 29 3b | 0d 76 6f 69 64 20 44 6f |Result);|.void Do|
|00001d10| 4e 65 77 28 76 6f 69 64 | 29 3b 0d 42 6f 6f 6c 65 |New(void|);.Boole|
|00001d20| 61 6e 20 44 6f 43 6c 6f | 73 65 57 69 6e 64 6f 77 |an DoClo|seWindow|
|00001d30| 28 57 69 6e 64 6f 77 50 | 74 72 20 77 69 6e 64 6f |(WindowP|tr windo|
|00001d40| 77 29 3b 0d 23 69 66 20 | 71 41 70 70 6c 65 45 76 |w);.#if |qAppleEv|
|00001d50| 65 6e 74 73 0d 73 74 61 | 74 69 63 20 76 6f 69 64 |ents.sta|tic void|
|00001d60| 20 50 72 65 70 61 72 65 | 54 6f 51 75 69 74 28 76 | Prepare|ToQuit(v|
|00001d70| 6f 69 64 29 3b 0d 23 65 | 6c 73 65 20 2f 2f 20 71 |oid);.#e|lse // q|
|00001d80| 41 70 70 6c 65 45 76 65 | 6e 74 73 0d 73 74 61 74 |AppleEve|nts.stat|
|00001d90| 69 63 20 76 6f 69 64 20 | 54 65 72 6d 69 6e 61 74 |ic void |Terminat|
|00001da0| 65 28 76 6f 69 64 29 3b | 0d 23 65 6e 64 69 66 20 |e(void);|.#endif |
|00001db0| 2f 2f 20 71 41 70 70 6c | 65 45 76 65 6e 74 73 0d |// qAppl|eEvents.|
|00001dc0| 76 6f 69 64 20 49 6e 69 | 74 69 61 6c 69 7a 65 28 |void Ini|tialize(|
|00001dd0| 76 6f 69 64 29 3b 0d 76 | 6f 69 64 20 42 69 67 42 |void);.v|oid BigB|
|00001de0| 61 64 45 72 72 6f 72 28 | 73 68 6f 72 74 20 65 72 |adError(|short er|
|00001df0| 72 6f 72 29 3b 0d 73 74 | 61 74 69 63 20 76 6f 69 |ror);.st|atic voi|
|00001e00| 64 20 46 61 69 6c 4e 69 | 6c 55 50 50 28 55 6e 69 |d FailNi|lUPP(Uni|
|00001e10| 76 65 72 73 61 6c 50 72 | 6f 63 50 74 72 20 74 68 |versalPr|ocPtr th|
|00001e20| 65 55 50 50 29 3b 0d 76 | 6f 69 64 20 47 65 74 54 |eUPP);.v|oid GetT|
|00001e30| 45 52 65 63 74 28 57 69 | 6e 64 6f 77 50 74 72 20 |ERect(Wi|ndowPtr |
|00001e40| 77 69 6e 64 6f 77 2c 20 | 52 65 63 74 20 2a 74 65 |window, |Rect *te|
|00001e50| 52 65 63 74 29 3b 0d 76 | 6f 69 64 20 41 64 6a 75 |Rect);.v|oid Adju|
|00001e60| 73 74 56 69 65 77 52 65 | 63 74 28 54 45 48 61 6e |stViewRe|ct(TEHan|
|00001e70| 64 6c 65 20 64 6f 63 54 | 45 29 3b 0d 76 6f 69 64 |dle docT|E);.void|
|00001e80| 20 41 64 6a 75 73 74 54 | 45 28 57 69 6e 64 6f 77 | AdjustT|E(Window|
|00001e90| 50 74 72 20 77 69 6e 64 | 6f 77 29 3b 0d 76 6f 69 |Ptr wind|ow);.voi|
|00001ea0| 64 20 41 64 6a 75 73 74 | 48 56 28 42 6f 6f 6c 65 |d Adjust|HV(Boole|
|00001eb0| 61 6e 20 69 73 56 65 72 | 74 2c 20 43 6f 6e 74 72 |an isVer|t, Contr|
|00001ec0| 6f 6c 48 61 6e 64 6c 65 | 20 63 6f 6e 74 72 6f 6c |olHandle| control|
|00001ed0| 2c 20 54 45 48 61 6e 64 | 6c 65 20 64 6f 63 54 45 |, TEHand|le docTE|
|00001ee0| 2c 20 42 6f 6f 6c 65 61 | 6e 20 63 61 6e 52 65 64 |, Boolea|n canRed|
|00001ef0| 72 61 77 29 3b 0d 76 6f | 69 64 20 41 64 6a 75 73 |raw);.vo|id Adjus|
|00001f00| 74 53 63 72 6f 6c 6c 56 | 61 6c 75 65 73 28 57 69 |tScrollV|alues(Wi|
|00001f10| 6e 64 6f 77 50 74 72 20 | 77 69 6e 64 6f 77 2c 20 |ndowPtr |window, |
|00001f20| 42 6f 6f 6c 65 61 6e 20 | 63 61 6e 52 65 64 72 61 |Boolean |canRedra|
|00001f30| 77 29 3b 0d 76 6f 69 64 | 20 41 64 6a 75 73 74 53 |w);.void| AdjustS|
|00001f40| 63 72 6f 6c 6c 53 69 7a | 65 73 28 57 69 6e 64 6f |crollSiz|es(Windo|
|00001f50| 77 50 74 72 20 77 69 6e | 64 6f 77 29 3b 0d 76 6f |wPtr win|dow);.vo|
|00001f60| 69 64 20 41 64 6a 75 73 | 74 53 63 72 6f 6c 6c 62 |id Adjus|tScrollb|
|00001f70| 61 72 73 28 57 69 6e 64 | 6f 77 50 74 72 20 77 69 |ars(Wind|owPtr wi|
|00001f80| 6e 64 6f 77 2c 20 42 6f | 6f 6c 65 61 6e 20 6e 65 |ndow, Bo|olean ne|
|00001f90| 65 64 73 52 65 73 69 7a | 65 29 3b 0d 23 69 66 20 |edsResiz|e);.#if |
|00001fa0| 70 6f 77 65 72 63 0d 70 | 61 73 63 61 6c 20 42 6f |powerc.p|ascal Bo|
|00001fb0| 6f 6c 65 61 6e 20 43 6c | 69 63 6b 4c 6f 6f 70 50 |olean Cl|ickLoopP|
|00001fc0| 72 6f 63 28 54 45 50 74 | 72 20 70 54 45 29 3b 0d |roc(TEPt|r pTE);.|
|00001fd0| 23 65 6c 73 65 0d 65 78 | 74 65 72 6e 20 70 61 73 |#else.ex|tern pas|
|00001fe0| 63 61 6c 20 76 6f 69 64 | 20 41 73 6d 43 6c 69 63 |cal void| AsmClic|
|00001ff0| 6b 4c 6f 6f 70 50 72 6f | 63 28 76 6f 69 64 29 3b |kLoopPro|c(void);|
|00002000| 0d 23 65 6e 64 69 66 0d | 70 61 73 63 61 6c 20 76 |.#endif.|pascal v|
|00002010| 6f 69 64 20 43 6c 69 63 | 6b 4c 6f 6f 70 41 64 64 |oid Clic|kLoopAdd|
|00002020| 4f 6e 28 76 6f 69 64 29 | 3b 0d 70 61 73 63 61 6c |On(void)|;.pascal|
|00002030| 20 54 45 43 6c 69 63 6b | 4c 6f 6f 70 55 50 50 20 | TEClick|LoopUPP |
|00002040| 47 65 74 4f 6c 64 43 6c | 69 63 6b 4c 6f 6f 70 28 |GetOldCl|ickLoop(|
|00002050| 76 6f 69 64 29 3b 0d 42 | 6f 6f 6c 65 61 6e 20 49 |void);.B|oolean I|
|00002060| 73 44 6f 63 75 6d 65 6e | 74 57 69 6e 64 6f 77 28 |sDocumen|tWindow(|
|00002070| 57 69 6e 64 6f 77 50 74 | 72 20 77 69 6e 64 6f 77 |WindowPt|r window|
|00002080| 29 3b 0d 42 6f 6f 6c 65 | 61 6e 20 49 73 44 41 57 |);.Boole|an IsDAW|
|00002090| 69 6e 64 6f 77 28 57 69 | 6e 64 6f 77 50 74 72 20 |indow(Wi|ndowPtr |
|000020a0| 77 69 6e 64 6f 77 29 3b | 0d 42 6f 6f 6c 65 61 6e |window);|.Boolean|
|000020b0| 20 54 72 61 70 41 76 61 | 69 6c 61 62 6c 65 28 73 | TrapAva|ilable(s|
|000020c0| 68 6f 72 74 20 74 68 65 | 54 72 61 70 29 3b 0d 73 |hort the|Trap);.s|
|000020d0| 74 61 74 69 63 20 76 6f | 69 64 20 50 72 69 6e 74 |tatic vo|id Print|
|000020e0| 54 65 78 74 28 54 45 48 | 61 6e 64 6c 65 20 74 68 |Text(TEH|andle th|
|000020f0| 65 54 65 78 74 29 3b 0d | 23 69 66 20 71 41 70 70 |eText);.|#if qApp|
|00002100| 6c 65 45 76 65 6e 74 73 | 0d 73 74 61 74 69 63 20 |leEvents|.static |
|00002110| 76 6f 69 64 20 43 68 65 | 63 6b 41 70 70 6c 65 45 |void Che|ckAppleE|
|00002120| 76 65 6e 74 73 28 76 6f | 69 64 29 3b 0d 73 74 61 |vents(vo|id);.sta|
|00002130| 74 69 63 20 4f 53 45 72 | 72 20 49 6e 73 74 61 6c |tic OSEr|r Instal|
|00002140| 6c 52 65 71 75 69 72 65 | 64 41 70 70 6c 65 45 76 |lRequire|dAppleEv|
|00002150| 65 6e 74 73 28 76 6f 69 | 64 29 3b 0d 73 74 61 74 |ents(voi|d);.stat|
|00002160| 69 63 20 4f 53 45 72 72 | 20 47 6f 74 52 65 71 75 |ic OSErr| GotRequ|
|00002170| 69 72 65 64 50 61 72 61 | 6d 65 74 65 72 73 28 63 |iredPara|meters(c|
|00002180| 6f 6e 73 74 20 41 70 70 | 6c 65 45 76 65 6e 74 20 |onst App|leEvent |
|00002190| 2a 74 68 65 41 70 70 6c | 65 45 76 65 6e 74 29 3b |*theAppl|eEvent);|
|000021a0| 0d 70 61 73 63 61 6c 20 | 4f 53 45 72 72 20 48 61 |.pascal |OSErr Ha|
|000021b0| 6e 64 6c 65 4f 41 70 70 | 45 76 65 6e 74 28 63 6f |ndleOApp|Event(co|
|000021c0| 6e 73 74 20 41 70 70 6c | 65 45 76 65 6e 74 20 2a |nst Appl|eEvent *|
|000021d0| 74 68 65 45 76 65 6e 74 | 2c 20 63 6f 6e 73 74 20 |theEvent|, const |
|000021e0| 41 70 70 6c 65 45 76 65 | 6e 74 20 2a 72 65 70 6c |AppleEve|nt *repl|
|000021f0| 79 2c 20 6c 6f 6e 67 20 | 72 65 66 43 6f 6e 29 3b |y, long |refCon);|
|00002200| 0d 70 61 73 63 61 6c 20 | 4f 53 45 72 72 20 48 61 |.pascal |OSErr Ha|
|00002210| 6e 64 6c 65 44 6f 63 45 | 76 65 6e 74 28 63 6f 6e |ndleDocE|vent(con|
|00002220| 73 74 20 41 70 70 6c 65 | 45 76 65 6e 74 20 2a 74 |st Apple|Event *t|
|00002230| 68 65 45 76 65 6e 74 2c | 20 63 6f 6e 73 74 20 41 |heEvent,| const A|
|00002240| 70 70 6c 65 45 76 65 6e | 74 20 2a 72 65 70 6c 79 |ppleEven|t *reply|
|00002250| 2c 20 6c 6f 6e 67 20 72 | 65 66 43 6f 6e 29 3b 0d |, long r|efCon);.|
|00002260| 70 61 73 63 61 6c 20 4f | 53 45 72 72 20 48 61 6e |pascal O|SErr Han|
|00002270| 64 6c 65 51 75 69 74 45 | 76 65 6e 74 28 63 6f 6e |dleQuitE|vent(con|
|00002280| 73 74 20 41 70 70 6c 65 | 45 76 65 6e 74 20 2a 74 |st Apple|Event *t|
|00002290| 68 65 45 76 65 6e 74 2c | 20 63 6f 6e 73 74 20 41 |heEvent,| const A|
|000022a0| 70 70 6c 65 45 76 65 6e | 74 20 2a 72 65 70 6c 79 |ppleEven|t *reply|
|000022b0| 2c 20 6c 6f 6e 67 20 72 | 65 66 43 6f 6e 29 3b 0d |, long r|efCon);.|
|000022c0| 23 69 66 20 71 49 6e 6c | 69 6e 65 0d 73 74 61 74 |#if qInl|ine.stat|
|000022d0| 69 63 20 76 6f 69 64 20 | 43 68 65 63 6b 46 6f 72 |ic void |CheckFor|
|000022e0| 54 65 78 74 53 65 72 76 | 69 63 65 73 28 76 6f 69 |TextServ|ices(voi|
|000022f0| 64 29 3b 0d 73 74 61 74 | 69 63 20 70 61 73 63 61 |d);.stat|ic pasca|
|00002300| 6c 20 76 6f 69 64 20 4d | 79 54 53 4d 54 45 50 72 |l void M|yTSMTEPr|
|00002310| 65 55 70 64 61 74 65 50 | 72 6f 63 28 54 45 48 61 |eUpdateP|roc(TEHa|
|00002320| 6e 64 6c 65 20 74 65 78 | 74 48 2c 20 6c 6f 6e 67 |ndle tex|tH, long|
|00002330| 20 72 65 66 43 6f 6e 29 | 3b 0d 73 74 61 74 69 63 | refCon)|;.static|
|00002340| 20 70 61 73 63 61 6c 20 | 76 6f 69 64 20 4d 79 54 | pascal |void MyT|
|00002350| 53 4d 54 45 50 6f 73 74 | 55 70 64 61 74 65 50 72 |SMTEPost|UpdatePr|
|00002360| 6f 63 28 54 45 48 61 6e | 64 6c 65 20 74 65 78 74 |oc(TEHan|dle text|
|00002370| 48 2c 20 6c 6f 6e 67 20 | 66 69 78 4c 65 6e 2c 20 |H, long |fixLen, |
|00002380| 6c 6f 6e 67 20 69 6e 70 | 75 74 41 72 65 61 53 74 |long inp|utAreaSt|
|00002390| 61 72 74 2c 0d 09 09 09 | 6c 6f 6e 67 20 69 6e 70 |art,....|long inp|
|000023a0| 75 74 41 72 65 61 45 6e | 64 2c 20 6c 6f 6e 67 20 |utAreaEn|d, long |
|000023b0| 70 69 6e 53 74 61 72 74 | 2c 20 6c 6f 6e 67 20 70 |pinStart|, long p|
|000023c0| 69 6e 45 6e 64 2c 20 6c | 6f 6e 67 20 72 65 66 43 |inEnd, l|ong refC|
|000023d0| 6f 6e 29 3b 0d 73 74 61 | 74 69 63 20 76 6f 69 64 |on);.sta|tic void|
|000023e0| 20 45 78 69 74 41 70 70 | 6c 69 63 61 74 69 6f 6e | ExitApp|lication|
|000023f0| 28 76 6f 69 64 29 3b 0d | 23 65 6e 64 69 66 20 2f |(void);.|#endif /|
|00002400| 2f 20 71 49 6e 6c 69 6e | 65 0d 23 65 6e 64 69 66 |/ qInlin|e.#endif|
|00002410| 20 2f 2f 20 71 41 70 70 | 6c 65 45 76 65 6e 74 73 | // qApp|leEvents|
|00002420| 0d 0d 0d 0d 2f 2f 20 53 | 65 74 20 75 70 20 74 68 |....// S|et up th|
|00002430| 65 20 77 68 6f 6c 65 20 | 77 6f 72 6c 64 2c 20 69 |e whole |world, i|
|00002440| 6e 63 6c 75 64 69 6e 67 | 20 67 6c 6f 62 61 6c 20 |ncluding| global |
|00002450| 76 61 72 69 61 62 6c 65 | 73 2c 20 54 6f 6f 6c 62 |variable|s, Toolb|
|00002460| 6f 78 20 6d 61 6e 61 67 | 65 72 73 2e 0d 2f 2f 20 |ox manag|ers..// |
|00002470| 49 66 20 61 20 70 72 6f | 62 6c 65 6d 20 6f 63 63 |If a pro|blem occ|
|00002480| 75 72 73 20 68 65 72 65 | 2c 20 77 65 20 61 6c 65 |urs here|, we ale|
|00002490| 72 74 20 74 68 65 20 75 | 73 65 72 20 61 6e 64 20 |rt the u|ser and |
|000024a0| 65 78 69 74 20 66 72 6f | 6d 20 74 68 65 20 61 70 |exit fro|m the ap|
|000024b0| 70 6c 69 63 61 74 69 6f | 6e 2e 0d 0d 76 6f 69 64 |plicatio|n...void|
|000024c0| 20 49 6e 69 74 69 61 6c | 69 7a 65 28 76 6f 69 64 | Initial|ize(void|
|000024d0| 29 0d 7b 0d 09 45 76 65 | 6e 74 52 65 63 6f 72 64 |).{..Eve|ntRecord|
|000024e0| 20 65 76 65 6e 74 3b 0d | 09 73 68 6f 72 74 20 63 | event;.|.short c|
|000024f0| 6f 75 6e 74 3b 0d 09 53 | 79 73 45 6e 76 52 65 63 |ount;..S|ysEnvRec|
|00002500| 20 73 79 73 74 65 6d 45 | 6e 76 69 72 6f 6e 6d 65 | systemE|nvironme|
|00002510| 6e 74 3b 0d 09 6c 6f 6e | 67 20 74 6f 74 61 6c 2c |nt;..lon|g total,|
|00002520| 20 63 6f 6e 74 69 67 3b | 0d 09 48 61 6e 64 6c 65 | contig;|..Handle|
|00002530| 20 6d 65 6e 75 42 61 72 | 3b 0d 0d 09 67 49 6e 42 | menuBar|;...gInB|
|00002540| 61 63 6b 67 72 6f 75 6e | 64 20 3d 20 66 61 6c 73 |ackgroun|d = fals|
|00002550| 65 3b 0d 23 69 66 20 71 | 41 70 70 6c 65 45 76 65 |e;.#if q|AppleEve|
|00002560| 6e 74 73 0d 09 67 51 75 | 69 74 74 69 6e 67 20 3d |nts..gQu|itting =|
|00002570| 20 66 61 6c 73 65 3b 0d | 23 65 6e 64 69 66 20 2f | false;.|#endif /|
|00002580| 2f 20 71 41 70 70 6c 65 | 45 76 65 6e 74 73 0d 0d |/ qApple|Events..|
|00002590| 09 49 6e 69 74 47 72 61 | 66 28 28 50 74 72 29 20 |.InitGra|f((Ptr) |
|000025a0| 26 71 64 2e 74 68 65 50 | 6f 72 74 29 3b 0d 09 49 |&qd.theP|ort);..I|
|000025b0| 6e 69 74 46 6f 6e 74 73 | 28 29 3b 0d 09 49 6e 69 |nitFonts|();..Ini|
|000025c0| 74 57 69 6e 64 6f 77 73 | 28 29 3b 0d 09 49 6e 69 |tWindows|();..Ini|
|000025d0| 74 4d 65 6e 75 73 28 29 | 3b 0d 09 54 45 49 6e 69 |tMenus()|;..TEIni|
|000025e0| 74 28 29 3b 0d 09 49 6e | 69 74 44 69 61 6c 6f 67 |t();..In|itDialog|
|000025f0| 73 28 6e 69 6c 29 3b 0d | 09 49 6e 69 74 43 75 72 |s(nil);.|.InitCur|
|00002600| 73 6f 72 28 29 3b 0d 0d | 09 2f 2f 20 74 68 65 20 |sor();..|.// the |
|00002610| 66 6f 6c 6c 6f 77 69 6e | 67 20 6c 6f 6f 70 20 69 |followin|g loop i|
|00002620| 73 20 6e 65 63 65 73 73 | 61 72 79 20 74 6f 20 61 |s necess|ary to a|
|00002630| 6c 6c 6f 77 20 74 68 65 | 20 64 65 66 61 75 6c 74 |llow the| default|
|00002640| 20 62 75 74 74 6f 6e 20 | 6f 66 20 6f 75 72 0d 09 | button |of our..|
|00002650| 2f 2f 20 61 6c 65 72 74 | 20 74 6f 20 62 65 20 6f |// alert| to be o|
|00002660| 75 74 6c 69 6e 65 64 2e | 20 57 65 20 75 73 65 20 |utlined.| We use |
|00002670| 45 76 65 6e 74 41 76 61 | 69 6c 20 69 6e 73 74 65 |EventAva|il inste|
|00002680| 61 64 20 6f 66 20 47 65 | 74 4e 65 78 74 45 76 65 |ad of Ge|tNextEve|
|00002690| 6e 74 20 73 6f 20 77 65 | 0d 09 2f 2f 20 64 6f 6e |nt so we|..// don|
|000026a0| 27 74 20 6c 6f 73 65 20 | 65 76 65 6e 74 73 2e 0d |'t lose |events..|
|000026b0| 09 0d 09 66 6f 72 20 28 | 63 6f 75 6e 74 20 3d 20 |...for (|count = |
|000026c0| 31 3b 20 63 6f 75 6e 74 | 20 3c 3d 20 33 3b 20 63 |1; count| <= 3; c|
|000026d0| 6f 75 6e 74 2b 2b 29 0d | 09 09 45 76 65 6e 74 41 |ount++).|..EventA|
|000026e0| 76 61 69 6c 28 65 76 65 | 72 79 45 76 65 6e 74 2c |vail(eve|ryEvent,|
|000026f0| 20 26 65 76 65 6e 74 29 | 3b 0d 09 0d 09 2f 2f 20 | &event)|;....// |
|00002700| 63 6f 6c 6c 65 63 74 20 | 65 6e 76 69 72 6f 6e 6d |collect |environm|
|00002710| 65 6e 74 20 69 6e 66 6f | 72 6d 61 74 69 6f 6e 0d |ent info|rmation.|
|00002720| 0d 09 2f 2f 20 69 67 6e | 6f 72 65 20 74 68 65 20 |..// ign|ore the |
|00002730| 65 72 72 6f 72 20 72 65 | 74 75 72 6e 65 64 20 66 |error re|turned f|
|00002740| 72 6f 6d 20 53 79 73 45 | 6e 76 69 72 6f 6e 73 3b |rom SysE|nvirons;|
|00002750| 20 65 76 65 6e 20 69 66 | 20 61 6e 20 65 72 72 6f | even if| an erro|
|00002760| 72 20 6f 63 63 75 72 72 | 65 64 2c 0d 09 2f 2f 20 |r occurr|ed,..// |
|00002770| 74 68 65 20 53 79 73 45 | 6e 76 69 72 6f 6e 73 20 |the SysE|nvirons |
|00002780| 67 6c 75 65 20 77 69 6c | 6c 20 66 69 6c 6c 20 69 |glue wil|l fill i|
|00002790| 6e 20 74 68 65 20 53 79 | 73 45 6e 76 52 65 63 2e |n the Sy|sEnvRec.|
|000027a0| 0d 09 20 0d 09 53 79 73 | 45 6e 76 69 72 6f 6e 73 |.. ..Sys|Environs|
|000027b0| 28 6b 53 79 73 45 6e 76 | 69 72 6f 6e 73 56 65 72 |(kSysEnv|ironsVer|
|000027c0| 73 69 6f 6e 2c 20 26 73 | 79 73 74 65 6d 45 6e 76 |sion, &s|ystemEnv|
|000027d0| 69 72 6f 6e 6d 65 6e 74 | 29 3b 0d 09 0d 09 2f 2f |ironment|);....//|
|000027e0| 20 6d 61 6b 65 20 73 75 | 72 65 20 74 68 61 74 20 | make su|re that |
|000027f0| 74 68 65 20 6d 61 63 68 | 69 6e 65 20 68 61 73 20 |the mach|ine has |
|00002800| 61 74 20 6c 65 61 73 74 | 20 31 32 38 4b 20 52 4f |at least| 128K RO|
|00002810| 4d 73 2e 20 49 66 20 69 | 74 20 64 6f 65 73 6e 27 |Ms. If i|t doesn'|
|00002820| 74 2c 20 65 78 69 74 2e | 0d 09 0d 09 69 66 20 28 |t, exit.|....if (|
|00002830| 73 79 73 74 65 6d 45 6e | 76 69 72 6f 6e 6d 65 6e |systemEn|vironmen|
|00002840| 74 2e 6d 61 63 68 69 6e | 65 54 79 70 65 20 3c 20 |t.machin|eType < |
|00002850| 30 29 0d 09 09 42 69 67 | 42 61 64 45 72 72 6f 72 |0)...Big|BadError|
|00002860| 28 65 4f 6c 64 52 4f 4d | 29 3b 0d 09 0d 09 2f 2f |(eOldROM|);....//|
|00002870| 20 61 6c 73 6f 2c 20 72 | 65 71 75 69 72 65 20 61 | also, r|equire a|
|00002880| 74 20 6c 65 61 73 74 20 | 73 79 73 74 65 6d 20 36 |t least |system 6|
|00002890| 2e 30 2e 20 54 68 65 20 | 61 70 70 20 73 68 6f 75 |.0. The |app shou|
|000028a0| 6c 64 20 62 65 20 61 62 | 6c 65 20 74 6f 20 72 75 |ld be ab|le to ru|
|000028b0| 6e 20 6f 6e 20 73 79 73 | 74 65 6d 0d 09 2f 2f 20 |n on sys|tem..// |
|000028c0| 73 6f 66 74 77 61 72 65 | 20 34 2e 31 20 28 77 68 |software| 4.1 (wh|
|000028d0| 65 72 65 20 73 74 79 6c | 65 64 20 54 65 78 74 45 |ere styl|ed TextE|
|000028e0| 64 69 74 20 77 61 73 20 | 69 6e 74 72 6f 64 75 63 |dit was |introduc|
|000028f0| 65 64 29 20 61 6e 64 20 | 6c 61 74 65 72 2c 20 62 |ed) and |later, b|
|00002900| 75 74 20 69 74 27 73 20 | 6e 6f 74 20 72 65 61 6c |ut it's |not real|
|00002910| 6c 79 0d 09 2f 2f 20 77 | 6f 72 74 68 20 74 68 65 |ly..// w|orth the|
|00002920| 20 74 72 6f 75 62 6c 65 | 20 6f 66 20 74 65 73 74 | trouble| of test|
|00002930| 69 6e 67 20 6f 6e 20 61 | 6c 6c 20 74 68 6f 73 65 |ing on a|ll those|
|00002940| 20 6f 6c 64 20 73 79 73 | 74 65 6d 73 20 61 6e 79 | old sys|tems any|
|00002950| 6d 6f 72 65 2e 0d 09 0d | 09 69 66 20 28 73 79 73 |more....|.if (sys|
|00002960| 74 65 6d 45 6e 76 69 72 | 6f 6e 6d 65 6e 74 2e 73 |temEnvir|onment.s|
|00002970| 79 73 74 65 6d 56 65 72 | 73 69 6f 6e 20 3c 20 30 |ystemVer|sion < 0|
|00002980| 78 36 30 30 29 0d 09 09 | 42 69 67 42 61 64 45 72 |x600)...|BigBadEr|
|00002990| 72 6f 72 28 65 4f 6c 64 | 53 79 73 74 65 6d 53 6f |ror(eOld|SystemSo|
|000029a0| 66 74 77 61 72 65 29 3b | 0d 09 0d 09 2f 2f 20 49 |ftware);|....// I|
|000029b0| 74 20 69 73 20 62 65 74 | 74 65 72 20 74 6f 20 66 |t is bet|ter to f|
|000029c0| 69 72 73 74 20 63 68 65 | 63 6b 20 74 68 65 20 73 |irst che|ck the s|
|000029d0| 69 7a 65 20 6f 66 20 74 | 68 65 20 61 70 70 6c 69 |ize of t|he appli|
|000029e0| 63 61 74 69 6f 6e 20 68 | 65 61 70 20 61 67 61 69 |cation h|eap agai|
|000029f0| 6e 73 74 20 61 20 76 61 | 6c 75 65 0d 09 2f 2f 20 |nst a va|lue..// |
|00002a00| 74 68 61 74 20 79 6f 75 | 20 68 61 76 65 20 64 65 |that you| have de|
|00002a10| 74 65 72 6d 69 6e 65 64 | 20 69 73 20 74 68 65 20 |termined| is the |
|00002a20| 73 6d 61 6c 6c 65 73 74 | 20 68 65 61 70 20 74 68 |smallest| heap th|
|00002a30| 65 20 61 70 70 6c 69 63 | 61 74 69 6f 6e 20 63 61 |e applic|ation ca|
|00002a40| 6e 20 72 65 61 73 6f 6e | 61 62 6c 79 0d 09 2f 2f |n reason|ably..//|
|00002a50| 20 77 6f 72 6b 20 69 6e | 2e 20 54 68 69 73 20 6e | work in|. This n|
|00002a60| 75 6d 62 65 72 20 73 68 | 6f 75 6c 64 20 62 65 20 |umber sh|ould be |
|00002a70| 64 65 72 69 76 65 64 20 | 62 79 20 65 78 61 6d 69 |derived |by exami|
|00002a80| 6e 69 6e 67 20 74 68 65 | 20 73 69 7a 65 20 6f 66 |ning the| size of|
|00002a90| 20 74 68 65 20 68 65 61 | 70 20 74 68 61 74 0d 09 | the hea|p that..|
|00002aa0| 2f 2f 20 69 73 20 61 63 | 74 75 61 6c 6c 79 20 70 |// is ac|tually p|
|00002ab0| 72 6f 76 69 64 65 64 20 | 62 79 20 4d 75 6c 74 69 |rovided |by Multi|
|00002ac0| 46 69 6e 64 65 72 20 77 | 68 65 6e 20 74 68 65 20 |Finder w|hen the |
|00002ad0| 6d 69 6e 69 6d 75 6d 20 | 73 69 7a 65 20 72 65 71 |minimum |size req|
|00002ae0| 75 65 73 74 65 64 20 69 | 73 20 75 73 65 64 2e 0d |uested i|s used..|
|00002af0| 09 2f 2f 20 54 68 65 20 | 63 68 65 63 6b 20 73 68 |.// The |check sh|
|00002b00| 6f 75 6c 64 20 62 65 20 | 6d 61 64 65 20 62 65 63 |ould be |made bec|
|00002b10| 61 75 73 65 20 74 68 65 | 20 70 72 65 66 65 72 72 |ause the| preferr|
|00002b20| 65 64 20 73 69 7a 65 20 | 63 61 6e 20 65 6e 64 20 |ed size |can end |
|00002b30| 75 70 20 62 65 69 6e 67 | 20 73 65 74 20 73 6d 61 |up being| set sma|
|00002b40| 6c 6c 65 72 0d 09 2f 2f | 20 74 68 61 6e 20 74 68 |ller..//| than th|
|00002b50| 65 20 6d 69 6e 69 6d 75 | 6d 20 73 69 7a 65 20 62 |e minimu|m size b|
|00002b60| 79 20 74 68 65 20 75 73 | 65 72 2e 20 54 68 69 73 |y the us|er. This|
|00002b70| 20 65 78 74 72 61 20 63 | 68 65 63 6b 20 61 63 74 | extra c|heck act|
|00002b80| 73 20 74 6f 20 69 6e 73 | 75 72 65 20 74 68 61 74 |s to ins|ure that|
|00002b90| 20 79 6f 75 72 0d 09 2f | 2f 20 61 70 70 6c 69 63 | your../|/ applic|
|00002ba0| 61 74 69 6f 6e 20 69 73 | 20 73 74 61 72 74 69 6e |ation is| startin|
|00002bb0| 67 20 66 72 6f 6d 20 61 | 20 73 6f 6c 69 64 20 6d |g from a| solid m|
|00002bc0| 65 6d 6f 72 79 20 66 6f | 75 6e 64 61 74 69 6f 6e |emory fo|undation|
|00002bd0| 2e 0d 09 20 0d 09 69 66 | 20 28 28 6c 6f 6e 67 29 |... ..if| ((long)|
|00002be0| 20 47 65 74 41 70 70 6c | 4c 69 6d 69 74 28 29 20 | GetAppl|Limit() |
|00002bf0| 2d 20 28 6c 6f 6e 67 29 | 20 41 70 70 6c 69 63 61 |- (long)| Applica|
|00002c00| 74 69 6f 6e 5a 6f 6e 65 | 28 29 20 3c 20 6b 4d 69 |tionZone|() < kMi|
|00002c10| 6e 48 65 61 70 29 0d 09 | 09 42 69 67 42 61 64 45 |nHeap)..|.BigBadE|
|00002c20| 72 72 6f 72 28 65 53 6d | 61 6c 6c 53 69 7a 65 29 |rror(eSm|allSize)|
|00002c30| 3b 0d 09 0d 09 2f 2f 20 | 4e 65 78 74 2c 20 6d 61 |;....// |Next, ma|
|00002c40| 6b 65 20 73 75 72 65 20 | 74 68 61 74 20 65 6e 6f |ke sure |that eno|
|00002c50| 75 67 68 20 6d 65 6d 6f | 72 79 20 69 73 20 66 72 |ugh memo|ry is fr|
|00002c60| 65 65 20 66 6f 72 20 79 | 6f 75 72 20 61 70 70 6c |ee for y|our appl|
|00002c70| 69 63 61 74 69 6f 6e 20 | 74 6f 20 72 75 6e 2e 20 |ication |to run. |
|00002c80| 49 74 0d 09 2f 2f 20 69 | 73 20 70 6f 73 73 69 62 |It..// i|s possib|
|00002c90| 6c 65 20 66 6f 72 20 61 | 20 73 69 74 75 61 74 69 |le for a| situati|
|00002ca0| 6f 6e 20 74 6f 20 61 72 | 69 73 65 20 77 68 65 72 |on to ar|ise wher|
|00002cb0| 65 20 74 68 65 20 68 65 | 61 70 20 6d 61 79 20 68 |e the he|ap may h|
|00002cc0| 61 76 65 20 62 65 65 6e | 20 6f 66 20 72 65 71 75 |ave been| of requ|
|00002cd0| 69 72 65 64 0d 09 2f 2f | 20 73 69 7a 65 2c 20 62 |ired..//| size, b|
|00002ce0| 75 74 20 61 20 6c 61 72 | 67 65 20 73 63 72 61 70 |ut a lar|ge scrap|
|00002cf0| 20 77 61 73 20 6c 6f 61 | 64 65 64 20 77 68 69 63 | was loa|ded whic|
|00002d00| 68 20 6c 65 66 74 20 74 | 6f 6f 20 6c 69 74 74 6c |h left t|oo littl|
|00002d10| 65 20 6d 65 6d 6f 72 79 | 2e 20 54 6f 20 63 68 65 |e memory|. To che|
|00002d20| 63 6b 20 66 6f 72 0d 09 | 2f 2f 20 74 68 69 73 2c |ck for..|// this,|
|00002d30| 20 63 61 6c 6c 20 50 75 | 72 67 65 53 70 61 63 65 | call Pu|rgeSpace|
|00002d40| 20 61 6e 64 20 63 6f 6d | 70 61 72 65 20 74 68 65 | and com|pare the|
|00002d50| 20 72 65 73 75 6c 74 20 | 77 69 74 68 20 61 20 76 | result |with a v|
|00002d60| 61 6c 75 65 20 74 68 61 | 74 20 79 6f 75 20 68 61 |alue tha|t you ha|
|00002d70| 76 65 20 64 65 74 65 72 | 6d 69 6e 65 64 0d 09 2f |ve deter|mined../|
|00002d80| 2f 20 69 73 20 74 68 65 | 20 6d 69 6e 69 6d 75 6d |/ is the| minimum|
|00002d90| 20 61 6d 6f 75 6e 74 20 | 6f 66 20 66 72 65 65 20 | amount |of free |
|00002da0| 6d 65 6d 6f 72 79 20 79 | 6f 75 72 20 61 70 70 6c |memory y|our appl|
|00002db0| 69 63 61 74 69 6f 6e 20 | 6e 65 65 64 73 20 61 74 |ication |needs at|
|00002dc0| 20 69 6e 69 74 69 61 6c | 69 7a 61 74 69 6f 6e 2e | initial|ization.|
|00002dd0| 0d 09 2f 2f 20 54 68 69 | 73 20 6e 75 6d 62 65 72 |..// Thi|s number|
|00002de0| 20 63 61 6e 20 62 65 20 | 64 65 72 69 76 65 64 20 | can be |derived |
|00002df0| 73 65 76 65 72 61 6c 20 | 64 69 66 66 65 72 65 6e |several |differen|
|00002e00| 74 20 77 61 79 73 2e 20 | 4f 6e 65 20 77 61 79 20 |t ways. |One way |
|00002e10| 74 68 61 74 20 69 73 20 | 66 61 69 72 6c 79 0d 09 |that is |fairly..|
|00002e20| 2f 2f 20 73 74 72 61 69 | 67 68 74 66 6f 72 77 61 |// strai|ghtforwa|
|00002e30| 72 64 20 69 73 20 74 6f | 20 72 75 6e 20 74 68 65 |rd is to| run the|
|00002e40| 20 61 70 70 6c 69 63 61 | 74 69 6f 6e 20 69 6e 20 | applica|tion in |
|00002e50| 74 68 65 20 6d 69 6e 69 | 6d 75 6d 20 73 69 7a 65 |the mini|mum size|
|00002e60| 20 63 6f 6e 66 69 67 75 | 72 61 74 69 6f 6e 0d 09 | configu|ration..|
|00002e70| 2f 2f 20 61 73 20 64 65 | 73 63 72 69 62 65 64 20 |// as de|scribed |
|00002e80| 70 72 65 76 69 6f 75 73 | 6c 79 2e 20 43 61 6c 6c |previous|ly. Call|
|00002e90| 20 50 75 72 67 65 53 70 | 61 63 65 20 61 74 20 69 | PurgeSp|ace at i|
|00002ea0| 6e 69 74 69 61 6c 69 7a | 61 74 69 6f 6e 20 61 6e |nitializ|ation an|
|00002eb0| 64 20 65 78 61 6d 69 6e | 65 20 74 68 65 20 76 61 |d examin|e the va|
|00002ec0| 6c 75 65 0d 09 2f 2f 20 | 72 65 74 75 72 6e 65 64 |lue..// |returned|
|00002ed0| 2e 20 48 6f 77 65 76 65 | 72 2c 20 79 6f 75 20 73 |. Howeve|r, you s|
|00002ee0| 68 6f 75 6c 64 20 6d 61 | 6b 65 20 73 75 72 65 20 |hould ma|ke sure |
|00002ef0| 74 68 61 74 20 74 68 69 | 73 20 72 65 73 75 6c 74 |that thi|s result|
|00002f00| 20 69 73 20 6e 6f 74 20 | 62 65 69 6e 67 20 6d 6f | is not |being mo|
|00002f10| 64 69 66 69 65 64 0d 09 | 2f 2f 20 62 79 20 74 68 |dified..|// by th|
|00002f20| 65 20 73 63 72 61 70 27 | 73 20 70 72 65 73 65 6e |e scrap'|s presen|
|00002f30| 63 65 2e 20 59 6f 75 20 | 63 61 6e 20 64 6f 20 74 |ce. You |can do t|
|00002f40| 68 61 74 20 62 79 20 63 | 61 6c 6c 69 6e 67 20 5a |hat by c|alling Z|
|00002f50| 65 72 6f 53 63 72 61 70 | 20 62 65 66 6f 72 65 20 |eroScrap| before |
|00002f60| 63 61 6c 6c 69 6e 67 0d | 09 2f 2f 20 50 75 72 67 |calling.|.// Purg|
|00002f70| 65 53 70 61 63 65 2e 20 | 4d 61 6b 65 20 73 75 72 |eSpace. |Make sur|
|00002f80| 65 20 74 6f 20 72 65 6d | 6f 76 65 20 74 68 61 74 |e to rem|ove that|
|00002f90| 20 63 61 6c 6c 20 62 65 | 66 6f 72 65 20 73 68 69 | call be|fore shi|
|00002fa0| 70 70 69 6e 67 2c 20 74 | 68 6f 75 67 68 2e 0d 09 |pping, t|hough...|
|00002fb0| 0d 09 2f 2f 20 5a 65 72 | 6f 53 63 72 61 70 28 29 |..// Zer|oScrap()|
|00002fc0| 3b 0d 0d 09 50 75 72 67 | 65 53 70 61 63 65 28 26 |;...Purg|eSpace(&|
|00002fd0| 74 6f 74 61 6c 2c 20 26 | 63 6f 6e 74 69 67 29 3b |total, &|contig);|
|00002fe0| 0d 09 69 66 20 28 74 6f | 74 61 6c 20 3c 20 6b 4d |..if (to|tal < kM|
|00002ff0| 69 6e 53 70 61 63 65 29 | 0d 09 09 69 66 20 28 55 |inSpace)|...if (U|
|00003000| 6e 6c 6f 61 64 53 63 72 | 61 70 28 29 20 21 3d 20 |nloadScr|ap() != |
|00003010| 6e 6f 45 72 72 29 0d 09 | 09 09 42 69 67 42 61 64 |noErr)..|..BigBad|
|00003020| 45 72 72 6f 72 28 65 4e | 6f 4d 65 6d 6f 72 79 29 |Error(eN|oMemory)|
|00003030| 3b 0d 09 09 65 6c 73 65 | 0d 09 09 7b 0d 09 09 09 |;...else|...{....|
|00003040| 50 75 72 67 65 53 70 61 | 63 65 28 26 74 6f 74 61 |PurgeSpa|ce(&tota|
|00003050| 6c 2c 20 26 63 6f 6e 74 | 69 67 29 3b 0d 09 09 09 |l, &cont|ig);....|
|00003060| 69 66 20 28 74 6f 74 61 | 6c 20 3c 20 6b 4d 69 6e |if (tota|l < kMin|
|00003070| 53 70 61 63 65 29 0d 09 | 09 09 09 42 69 67 42 61 |Space)..|...BigBa|
|00003080| 64 45 72 72 6f 72 28 65 | 4e 6f 4d 65 6d 6f 72 79 |dError(e|NoMemory|
|00003090| 29 3b 0d 09 09 7d 0d 0d | 09 2f 2f 20 54 68 65 20 |);...}..|.// The |
|000030a0| 65 78 74 72 61 20 62 65 | 6e 65 66 69 74 20 74 6f |extra be|nefit to|
|000030b0| 20 77 61 69 74 69 6e 67 | 20 75 6e 74 69 6c 20 61 | waiting| until a|
|000030c0| 66 74 65 72 20 74 68 65 | 20 54 6f 6f 6c 62 6f 78 |fter the| Toolbox|
|000030d0| 20 4d 61 6e 61 67 65 72 | 73 20 68 61 76 65 20 62 | Manager|s have b|
|000030e0| 65 65 6e 20 69 6e 69 74 | 69 61 6c 69 7a 65 64 0d |een init|ialized.|
|000030f0| 09 2f 2f 20 74 6f 20 63 | 68 65 63 6b 20 6d 65 6d |.// to c|heck mem|
|00003100| 6f 72 79 20 69 73 20 74 | 68 61 74 20 77 65 20 63 |ory is t|hat we c|
|00003110| 61 6e 20 6e 6f 77 20 67 | 69 76 65 20 74 68 65 20 |an now g|ive the |
|00003120| 75 73 65 72 20 61 6e 20 | 61 6c 65 72 74 20 74 6f |user an |alert to|
|00003130| 20 74 65 6c 6c 20 68 69 | 6d 2f 68 65 72 20 77 68 | tell hi|m/her wh|
|00003140| 61 74 0d 09 2f 2f 20 68 | 61 70 70 65 6e 65 64 2e |at..// h|appened.|
|00003150| 20 41 6c 74 68 6f 75 67 | 68 20 69 74 20 69 73 20 | Althoug|h it is |
|00003160| 70 6f 73 73 69 62 6c 65 | 20 74 68 61 74 20 74 68 |possible| that th|
|00003170| 65 20 6d 65 6d 6f 72 79 | 20 73 69 74 75 61 74 69 |e memory| situati|
|00003180| 6f 6e 20 63 6f 75 6c 64 | 20 62 65 20 77 6f 72 73 |on could| be wors|
|00003190| 65 6e 65 64 20 62 79 0d | 09 2f 2f 20 64 69 73 70 |ened by.|.// disp|
|000031a0| 6c 61 79 69 6e 67 20 61 | 6e 20 61 6c 65 72 74 2c |laying a|n alert,|
|000031b0| 20 4d 75 6c 74 69 46 69 | 6e 64 65 72 20 77 6f 75 | MultiFi|nder wou|
|000031c0| 6c 64 20 67 72 61 63 65 | 66 75 6c 6c 79 20 65 78 |ld grace|fully ex|
|000031d0| 69 74 20 74 68 65 20 61 | 70 70 6c 69 63 61 74 69 |it the a|pplicati|
|000031e0| 6f 6e 20 77 69 74 68 0d | 09 2f 2f 20 61 6e 20 69 |on with.|.// an i|
|000031f0| 6e 66 6f 72 6d 61 74 69 | 76 65 20 61 6c 65 72 74 |nformati|ve alert|
|00003200| 20 69 66 20 6d 65 6d 6f | 72 79 20 62 65 63 61 6d | if memo|ry becam|
|00003210| 65 20 63 72 69 74 69 63 | 61 6c 2e 20 48 65 72 65 |e critic|al. Here|
|00003220| 20 77 65 20 61 72 65 20 | 61 63 74 69 6e 67 20 6d | we are |acting m|
|00003230| 6f 72 65 0d 09 2f 2f 20 | 69 6e 20 61 20 70 72 65 |ore..// |in a pre|
|00003240| 76 65 6e 74 61 74 69 76 | 65 20 6d 61 6e 6e 65 72 |ventativ|e manner|
|00003250| 20 74 6f 20 61 76 6f 69 | 64 20 66 75 74 75 72 65 | to avoi|d future|
|00003260| 20 64 69 73 61 73 74 65 | 72 20 66 72 6f 6d 20 6c | disaste|r from l|
|00003270| 6f 77 2d 6d 65 6d 6f 72 | 79 20 70 72 6f 62 6c 65 |ow-memor|y proble|
|00003280| 6d 73 2e 0d 0d 09 2f 2f | 20 63 68 65 63 6b 20 66 |ms....//| check f|
|00003290| 6f 72 20 6e 65 77 65 72 | 20 73 79 73 74 65 6d 20 |or newer| system |
|000032a0| 73 65 72 76 69 63 65 73 | 20 61 6e 64 20 73 65 74 |services| and set|
|000032b0| 20 75 70 20 6f 75 72 20 | 65 6e 76 69 72 6f 6e 6d | up our |environm|
|000032c0| 65 6e 74 20 74 6f 20 6d | 61 6b 65 20 75 73 65 20 |ent to m|ake use |
|000032d0| 6f 66 20 77 68 61 74 27 | 73 20 61 76 61 69 6c 61 |of what'|s availa|
|000032e0| 62 6c 65 2e 0d 09 0d 09 | 67 48 61 73 57 61 69 74 |ble.....|gHasWait|
|000032f0| 4e 65 78 74 45 76 65 6e | 74 20 3d 20 54 72 61 70 |NextEven|t = Trap|
|00003300| 41 76 61 69 6c 61 62 6c | 65 28 5f 57 61 69 74 4e |Availabl|e(_WaitN|
|00003310| 65 78 74 45 76 65 6e 74 | 29 3b 0d 0d 23 69 66 20 |extEvent|);..#if |
|00003320| 71 41 70 70 6c 65 45 76 | 65 6e 74 73 0d 09 43 68 |qAppleEv|ents..Ch|
|00003330| 65 63 6b 41 70 70 6c 65 | 45 76 65 6e 74 73 28 29 |eckApple|Events()|
|00003340| 3b 0d 09 69 66 20 28 67 | 48 61 73 41 70 70 6c 65 |;..if (g|HasApple|
|00003350| 45 76 65 6e 74 73 29 0d | 09 09 28 76 6f 69 64 29 |Events).|..(void)|
|00003360| 20 49 6e 73 74 61 6c 6c | 52 65 71 75 69 72 65 64 | Install|Required|
|00003370| 41 70 70 6c 65 45 76 65 | 6e 74 73 28 29 3b 0d 23 |AppleEve|nts();.#|
|00003380| 69 66 20 71 49 6e 6c 69 | 6e 65 0d 0d 09 43 68 65 |if qInli|ne...Che|
|00003390| 63 6b 46 6f 72 54 65 78 | 74 53 65 72 76 69 63 65 |ckForTex|tService|
|000033a0| 73 28 29 3b 0d 09 0d 09 | 2f 2f 20 74 68 69 73 20 |s();....|// this |
|000033b0| 61 70 70 6c 69 63 61 74 | 69 6f 6e 20 75 73 65 73 |applicat|ion uses|
|000033c0| 20 54 65 78 74 45 64 69 | 74 20 61 73 20 74 68 65 | TextEdi|t as the|
|000033d0| 20 6f 6e 6c 79 20 74 65 | 78 74 20 65 6e 67 69 6e | only te|xt engin|
|000033e0| 65 2c 20 61 6e 64 20 77 | 65 20 64 6f 6e 27 74 20 |e, and w|e don't |
|000033f0| 73 75 70 70 6f 72 74 0d | 09 2f 2f 20 69 6e 6c 69 |support.|.// inli|
|00003400| 6e 65 20 69 6e 70 75 74 | 20 77 69 74 68 6f 75 74 |ne input| without|
|00003410| 20 54 53 4d 54 45 2e 20 | 54 68 65 72 65 66 6f 72 | TSMTE. |Therefor|
|00003420| 65 20 77 65 20 63 61 6c | 6c 20 49 6e 69 74 54 53 |e we cal|l InitTS|
|00003430| 4d 41 77 61 72 65 41 70 | 70 6c 69 63 61 74 69 6f |MAwareAp|plicatio|
|00003440| 6e 20 6f 6e 6c 79 20 69 | 66 0d 09 2f 2f 20 54 53 |n only i|f..// TS|
|00003450| 4d 54 45 20 69 73 20 61 | 76 61 69 6c 61 62 6c 65 |MTE is a|vailable|
|00003460| 2e 20 41 20 77 6f 72 64 | 20 70 72 6f 63 65 73 73 |. A word| process|
|00003470| 6f 72 20 74 68 61 74 20 | 75 73 65 73 20 54 65 78 |or that |uses Tex|
|00003480| 74 45 64 69 74 20 6f 6e | 6c 79 20 66 6f 72 20 64 |tEdit on|ly for d|
|00003490| 69 61 6c 6f 67 73 0d 09 | 2f 2f 20 61 6e 64 20 75 |ialogs..|// and u|
|000034a0| 73 65 73 20 54 65 78 74 | 20 53 65 72 76 69 63 65 |ses Text| Service|
|000034b0| 73 20 64 69 72 65 63 74 | 6c 79 20 77 69 74 68 20 |s direct|ly with |
|000034c0| 74 68 65 20 77 6f 72 64 | 20 70 72 6f 63 65 73 73 |the word| process|
|000034d0| 69 6e 67 20 65 6e 67 69 | 6e 65 20 77 6f 75 6c 64 |ing engi|ne would|
|000034e0| 20 6d 61 6b 65 20 74 68 | 69 73 0d 09 2f 2f 20 63 | make th|is..// c|
|000034f0| 61 6c 6c 20 64 65 70 65 | 6e 64 20 6f 6e 20 67 48 |all depe|nd on gH|
|00003500| 61 73 54 65 78 74 53 65 | 72 76 69 63 65 73 2e 0d |asTextSe|rvices..|
|00003510| 09 0d 09 69 66 20 28 21 | 28 67 48 61 73 54 53 4d |...if (!|(gHasTSM|
|00003520| 54 45 20 26 26 20 49 6e | 69 74 54 53 4d 41 77 61 |TE && In|itTSMAwa|
|00003530| 72 65 41 70 70 6c 69 63 | 61 74 69 6f 6e 28 29 20 |reApplic|ation() |
|00003540| 3d 3d 20 6e 6f 45 72 72 | 29 29 0d 09 7b 0d 09 09 |== noErr|))..{...|
|00003550| 2f 2f 20 69 66 20 74 68 | 69 73 20 68 61 70 70 65 |// if th|is happe|
|00003560| 6e 73 2c 20 6a 75 73 74 | 20 6d 6f 76 65 20 6f 6e |ns, just| move on|
|00003570| 20 77 69 74 68 6f 75 74 | 20 74 65 78 74 20 73 65 | without| text se|
|00003580| 72 76 69 63 65 73 0d 09 | 09 67 48 61 73 54 65 78 |rvices..|.gHasTex|
|00003590| 74 53 65 72 76 69 63 65 | 73 20 3d 20 66 61 6c 73 |tService|s = fals|
|000035a0| 65 3b 0d 09 09 67 48 61 | 73 54 53 4d 54 45 20 3d |e;...gHa|sTSMTE =|
|000035b0| 20 66 61 6c 73 65 3b 0d | 09 7d 0d 09 0d 09 2f 2f | false;.|.}....//|
|000035c0| 20 67 65 74 20 67 6c 6f | 62 61 6c 20 66 6f 6e 74 | get glo|bal font|
|000035d0| 46 6f 72 63 65 20 66 6c | 61 67 2c 20 6d 61 6b 65 |Force fl|ag, make|
|000035e0| 20 73 75 72 65 20 69 74 | 27 73 20 6f 66 66 20 77 | sure it|'s off w|
|000035f0| 68 65 6e 65 76 65 72 20 | 77 65 20 72 75 6e 0d 09 |henever |we run..|
|00003600| 0d 09 67 53 61 76 65 64 | 46 6f 6e 74 46 6f 72 63 |..gSaved|FontForc|
|00003610| 65 20 3d 20 47 65 74 53 | 63 72 69 70 74 4d 61 6e |e = GetS|criptMan|
|00003620| 61 67 65 72 56 61 72 69 | 61 62 6c 65 28 73 6d 46 |agerVari|able(smF|
|00003630| 6f 6e 74 46 6f 72 63 65 | 29 3b 0d 09 28 76 6f 69 |ontForce|);..(voi|
|00003640| 64 29 20 53 65 74 53 63 | 72 69 70 74 4d 61 6e 61 |d) SetSc|riptMana|
|00003650| 67 65 72 56 61 72 69 61 | 62 6c 65 28 73 6d 46 6f |gerVaria|ble(smFo|
|00003660| 6e 74 46 6f 72 63 65 2c | 20 30 29 3b 0d 23 65 6e |ntForce,| 0);.#en|
|00003670| 64 69 66 20 2f 2f 20 71 | 49 6e 6c 69 6e 65 0d 23 |dif // q|Inline.#|
|00003680| 65 6e 64 69 66 20 2f 2f | 20 71 41 70 70 6c 65 45 |endif //| qAppleE|
|00003690| 76 65 6e 74 73 0d 0d 09 | 2f 2f 20 73 65 74 20 75 |vents...|// set u|
|000036a0| 70 20 74 68 65 20 6d 65 | 6e 75 20 62 61 72 20 61 |p the me|nu bar a|
|000036b0| 6e 64 20 74 68 65 20 6d | 65 6e 75 73 20 74 68 61 |nd the m|enus tha|
|000036c0| 74 20 64 65 70 65 6e 64 | 20 6f 6e 20 74 68 65 20 |t depend| on the |
|000036d0| 73 79 73 74 65 6d 20 65 | 6e 76 69 72 6f 6e 6d 65 |system e|nvironme|
|000036e0| 6e 74 0d 09 0d 09 6d 65 | 6e 75 42 61 72 20 3d 20 |nt....me|nuBar = |
|000036f0| 47 65 74 4e 65 77 4d 42 | 61 72 28 72 4d 65 6e 75 |GetNewMB|ar(rMenu|
|00003700| 42 61 72 29 3b 09 0d 09 | 69 66 20 28 20 6d 65 6e |Bar);...|if ( men|
|00003710| 75 42 61 72 20 3d 3d 20 | 6e 69 6c 20 29 0d 09 09 |uBar == |nil )...|
|00003720| 42 69 67 42 61 64 45 72 | 72 6f 72 28 65 4e 6f 4d |BigBadEr|ror(eNoM|
|00003730| 65 6d 6f 72 79 29 3b 0d | 09 53 65 74 4d 65 6e 75 |emory);.|.SetMenu|
|00003740| 42 61 72 28 6d 65 6e 75 | 42 61 72 29 3b 0d 09 44 |Bar(menu|Bar);..D|
|00003750| 69 73 70 6f 73 65 48 61 | 6e 64 6c 65 28 6d 65 6e |isposeHa|ndle(men|
|00003760| 75 42 61 72 29 3b 0d 09 | 41 70 70 65 6e 64 52 65 |uBar);..|AppendRe|
|00003770| 73 4d 65 6e 75 28 47 65 | 74 4d 65 6e 75 48 61 6e |sMenu(Ge|tMenuHan|
|00003780| 64 6c 65 28 6d 41 70 70 | 6c 65 29 2c 20 27 44 52 |dle(mApp|le), 'DR|
|00003790| 56 52 27 29 3b 09 2f 2f | 20 62 75 69 6c 64 20 74 |VR');.//| build t|
|000037a0| 68 65 20 41 70 70 6c 65 | 20 6d 65 6e 75 0d 09 41 |he Apple| menu..A|
|000037b0| 70 70 65 6e 64 52 65 73 | 4d 65 6e 75 28 47 65 74 |ppendRes|Menu(Get|
|000037c0| 4d 65 6e 75 48 61 6e 64 | 6c 65 28 6d 46 6f 6e 74 |MenuHand|le(mFont|
|000037d0| 29 2c 20 27 46 4f 4e 54 | 27 29 3b 09 2f 2f 20 62 |), 'FONT|');.// b|
|000037e0| 75 69 6c 64 20 74 68 65 | 20 46 6f 6e 74 20 6d 65 |uild the| Font me|
|000037f0| 6e 75 0d 09 44 72 61 77 | 4d 65 6e 75 42 61 72 28 |nu..Draw|MenuBar(|
|00003800| 29 3b 0d 0d 09 2f 2f 20 | 77 65 20 68 61 76 65 20 |);...// |we have |
|00003810| 6e 6f 20 64 6f 63 75 6d | 65 6e 74 20 6f 70 65 6e |no docum|ent open|
|00003820| 20 79 65 74 0d 09 0d 09 | 67 4e 75 6d 44 6f 63 75 | yet....|gNumDocu|
|00003830| 6d 65 6e 74 73 20 3d 20 | 30 3b 0d 0d 09 2f 2f 20 |ments = |0;...// |
|00003840| 73 65 74 20 75 70 20 70 | 72 69 6e 74 65 72 20 73 |set up p|rinter s|
|00003850| 74 75 66 66 20 2d 20 74 | 68 69 73 20 77 69 6c 6c |tuff - t|his will|
|00003860| 20 61 6c 6c 6f 77 20 74 | 68 65 20 64 65 66 61 75 | allow t|he defau|
|00003870| 6c 74 20 70 61 67 65 20 | 73 65 74 75 70 20 70 61 |lt page |setup pa|
|00003880| 72 61 6d 65 74 65 72 73 | 20 74 6f 20 62 65 20 75 |rameters| to be u|
|00003890| 73 65 64 2c 0d 09 2f 2f | 20 73 6f 20 69 66 20 74 |sed,..//| so if t|
|000038a0| 68 65 20 75 73 65 72 20 | 64 65 63 69 64 65 73 20 |he user |decides |
|000038b0| 74 6f 20 70 72 69 6e 74 | 20 77 69 74 68 6f 75 74 |to print| without|
|000038c0| 20 75 73 69 6e 67 20 74 | 68 65 20 50 61 67 65 20 | using t|he Page |
|000038d0| 53 65 74 75 70 20 63 6f | 6d 6d 61 6e 64 20 65 76 |Setup co|mmand ev|
|000038e0| 65 72 79 74 68 69 6e 67 | 20 77 69 6c 6c 0d 09 2f |erything| will../|
|000038f0| 2f 20 62 65 20 4f 4b 0d | 09 0d 09 67 50 72 69 6e |/ be OK.|...gPrin|
|00003900| 74 65 72 52 65 63 6f 72 | 64 20 3d 20 28 54 48 50 |terRecor|d = (THP|
|00003910| 72 69 6e 74 29 20 4e 65 | 77 48 61 6e 64 6c 65 28 |rint) Ne|wHandle(|
|00003920| 73 69 7a 65 6f 66 28 54 | 50 72 69 6e 74 29 29 3b |sizeof(T|Print));|
|00003930| 0d 09 69 66 20 28 67 50 | 72 69 6e 74 65 72 52 65 |..if (gP|rinterRe|
|00003940| 63 6f 72 64 20 21 3d 20 | 6e 69 6c 29 0d 09 7b 0d |cord != |nil)..{.|
|00003950| 09 09 2f 2f 20 69 66 20 | 77 65 20 67 6f 74 20 61 |..// if |we got a|
|00003960| 20 70 72 69 6e 74 20 68 | 61 6e 64 6c 65 2c 20 69 | print h|andle, i|
|00003970| 6e 69 74 69 61 6c 69 7a | 65 20 69 74 20 74 6f 20 |nitializ|e it to |
|00003980| 64 65 66 61 75 6c 74 20 | 76 61 6c 75 65 73 0d 09 |default |values..|
|00003990| 09 50 72 4f 70 65 6e 28 | 29 3b 0d 09 09 50 72 69 |.PrOpen(|);...Pri|
|000039a0| 6e 74 44 65 66 61 75 6c | 74 28 67 50 72 69 6e 74 |ntDefaul|t(gPrint|
|000039b0| 65 72 52 65 63 6f 72 64 | 29 3b 0d 09 09 50 72 43 |erRecord|);...PrC|
|000039c0| 6c 6f 73 65 28 29 3b 0d | 09 7d 0d 09 0d 09 2f 2f |lose();.|.}....//|
|000039d0| 20 69 6e 69 74 69 61 6c | 69 7a 65 20 74 68 65 20 | initial|ize the |
|000039e0| 75 6e 69 76 65 72 73 61 | 6c 20 70 72 6f 63 65 64 |universa|l proced|
|000039f0| 75 72 65 20 70 6f 69 6e | 74 65 72 73 20 74 68 61 |ure poin|ters tha|
|00003a00| 74 20 77 65 20 6e 65 65 | 64 0d 23 69 66 20 71 41 |t we nee|d.#if qA|
|00003a10| 70 70 6c 65 45 76 65 6e | 74 73 0d 09 2f 2f 20 28 |ppleEven|ts..// (|
|00003a20| 41 70 70 6c 65 20 65 76 | 65 6e 74 20 68 61 6e 64 |Apple ev|ent hand|
|00003a30| 6c 65 72 20 55 50 50 73 | 20 61 72 65 20 73 65 74 |ler UPPs| are set|
|00003a40| 20 75 70 20 69 6e 20 49 | 6e 73 74 61 6c 6c 52 65 | up in I|nstallRe|
|00003a50| 71 75 69 72 65 64 41 70 | 70 6c 65 45 76 65 6e 74 |quiredAp|pleEvent|
|00003a60| 73 29 0d 23 65 6e 64 69 | 66 20 2f 2f 20 71 41 70 |s).#endi|f // qAp|
|00003a70| 70 6c 65 45 76 65 6e 74 | 73 0d 09 0d 09 67 48 41 |pleEvent|s....gHA|
|00003a80| 63 74 69 6f 6e 55 50 50 | 20 3d 20 4e 65 77 43 6f |ctionUPP| = NewCo|
|00003a90| 6e 74 72 6f 6c 41 63 74 | 69 6f 6e 50 72 6f 63 28 |ntrolAct|ionProc(|
|00003aa0| 48 41 63 74 69 6f 6e 50 | 72 6f 63 29 3b 0d 09 46 |HActionP|roc);..F|
|00003ab0| 61 69 6c 4e 69 6c 55 50 | 50 28 28 55 6e 69 76 65 |ailNilUP|P((Unive|
|00003ac0| 72 73 61 6c 50 72 6f 63 | 50 74 72 29 20 67 48 41 |rsalProc|Ptr) gHA|
|00003ad0| 63 74 69 6f 6e 55 50 50 | 29 3b 0d 09 67 56 41 63 |ctionUPP|);..gVAc|
|00003ae0| 74 69 6f 6e 55 50 50 20 | 3d 20 4e 65 77 43 6f 6e |tionUPP |= NewCon|
|00003af0| 74 72 6f 6c 41 63 74 69 | 6f 6e 50 72 6f 63 28 56 |trolActi|onProc(V|
|00003b00| 41 63 74 69 6f 6e 50 72 | 6f 63 29 3b 0d 09 46 61 |ActionPr|oc);..Fa|
|00003b10| 69 6c 4e 69 6c 55 50 50 | 28 28 55 6e 69 76 65 72 |ilNilUPP|((Univer|
|00003b20| 73 61 6c 50 72 6f 63 50 | 74 72 29 20 67 56 41 63 |salProcP|tr) gVAc|
|00003b30| 74 69 6f 6e 55 50 50 29 | 3b 0d 23 69 66 20 70 6f |tionUPP)|;.#if po|
|00003b40| 77 65 72 63 0d 09 67 43 | 6c 69 63 6b 4c 6f 6f 70 |werc..gC|lickLoop|
|00003b50| 55 50 50 20 3d 20 4e 65 | 77 54 45 43 6c 69 63 6b |UPP = Ne|wTEClick|
|00003b60| 4c 6f 6f 70 50 72 6f 63 | 28 43 6c 69 63 6b 4c 6f |LoopProc|(ClickLo|
|00003b70| 6f 70 50 72 6f 63 29 3b | 0d 09 46 61 69 6c 4e 69 |opProc);|..FailNi|
|00003b80| 6c 55 50 50 28 28 55 6e | 69 76 65 72 73 61 6c 50 |lUPP((Un|iversalP|
|00003b90| 72 6f 63 50 74 72 29 20 | 67 43 6c 69 63 6b 4c 6f |rocPtr) |gClickLo|
|00003ba0| 6f 70 55 50 50 29 3b 0d | 23 65 6e 64 69 66 0d 23 |opUPP);.|#endif.#|
|00003bb0| 69 66 20 71 49 6e 6c 69 | 6e 65 0d 09 69 66 20 28 |if qInli|ne..if (|
|00003bc0| 67 48 61 73 54 53 4d 54 | 45 29 0d 09 7b 0d 09 09 |gHasTSMT|E)..{...|
|00003bd0| 67 54 53 4d 54 45 50 72 | 65 55 70 64 61 74 65 55 |gTSMTEPr|eUpdateU|
|00003be0| 50 50 20 3d 20 4e 65 77 | 54 53 4d 54 45 50 72 65 |PP = New|TSMTEPre|
|00003bf0| 55 70 64 61 74 65 50 72 | 6f 63 28 4d 79 54 53 4d |UpdatePr|oc(MyTSM|
|00003c00| 54 45 50 72 65 55 70 64 | 61 74 65 50 72 6f 63 29 |TEPreUpd|ateProc)|
|00003c10| 3b 0d 09 09 46 61 69 6c | 4e 69 6c 55 50 50 28 28 |;...Fail|NilUPP((|
|00003c20| 55 6e 69 76 65 72 73 61 | 6c 50 72 6f 63 50 74 72 |Universa|lProcPtr|
|00003c30| 29 20 67 54 53 4d 54 45 | 50 72 65 55 70 64 61 74 |) gTSMTE|PreUpdat|
|00003c40| 65 55 50 50 29 3b 0d 09 | 09 67 54 53 4d 54 45 50 |eUPP);..|.gTSMTEP|
|00003c50| 6f 73 74 55 70 64 61 74 | 65 55 50 50 20 3d 20 4e |ostUpdat|eUPP = N|
|00003c60| 65 77 54 53 4d 54 45 50 | 6f 73 74 55 70 64 61 74 |ewTSMTEP|ostUpdat|
|00003c70| 65 50 72 6f 63 28 4d 79 | 54 53 4d 54 45 50 6f 73 |eProc(My|TSMTEPos|
|00003c80| 74 55 70 64 61 74 65 50 | 72 6f 63 29 3b 0d 09 09 |tUpdateP|roc);...|
|00003c90| 46 61 69 6c 4e 69 6c 55 | 50 50 28 28 55 6e 69 76 |FailNilU|PP((Univ|
|00003ca0| 65 72 73 61 6c 50 72 6f | 63 50 74 72 29 20 67 54 |ersalPro|cPtr) gT|
|00003cb0| 53 4d 54 45 50 6f 73 74 | 55 70 64 61 74 65 55 50 |SMTEPost|UpdateUP|
|00003cc0| 50 29 3b 0d 09 7d 0d 23 | 65 6e 64 69 66 20 2f 2f |P);..}.#|endif //|
|00003cd0| 20 71 49 6e 6c 69 6e 65 | 0d 7d 0d 0d 0d 2f 2f 20 | qInline|.}...// |
|00003ce0| 72 65 70 6f 72 74 20 61 | 20 66 61 74 61 6c 20 65 |report a| fatal e|
|00003cf0| 72 72 6f 72 20 74 6f 20 | 74 68 65 20 75 73 65 72 |rror to |the user|
|00003d00| 20 61 6e 64 20 65 78 69 | 74 20 66 72 6f 6d 20 74 | and exi|t from t|
|00003d10| 68 65 20 61 70 70 6c 69 | 63 61 74 69 6f 6e 0d 0d |he appli|cation..|
|00003d20| 76 6f 69 64 20 42 69 67 | 42 61 64 45 72 72 6f 72 |void Big|BadError|
|00003d30| 28 73 68 6f 72 74 20 65 | 72 72 6f 72 29 0d 7b 0d |(short e|rror).{.|
|00003d40| 09 41 6c 65 72 74 55 73 | 65 72 28 65 72 72 6f 72 |.AlertUs|er(error|
|00003d50| 29 3b 0d 23 69 66 20 71 | 49 6e 6c 69 6e 65 0d 09 |);.#if q|Inline..|
|00003d60| 45 78 69 74 41 70 70 6c | 69 63 61 74 69 6f 6e 28 |ExitAppl|ication(|
|00003d70| 29 3b 0d 23 65 6c 73 65 | 20 2f 2f 20 71 49 6e 6c |);.#else| // qInl|
|00003d80| 69 6e 65 0d 09 45 78 69 | 74 54 6f 53 68 65 6c 6c |ine..Exi|tToShell|
|00003d90| 28 29 3b 0d 23 65 6e 64 | 69 66 20 2f 2f 20 71 49 |();.#end|if // qI|
|00003da0| 6e 6c 69 6e 65 0d 7d 0d | 0d 0d 2f 2f 20 63 68 65 |nline.}.|..// che|
|00003db0| 63 6b 20 77 68 65 74 68 | 65 72 20 61 20 76 61 6c |ck wheth|er a val|
|00003dc0| 69 64 20 55 50 50 20 77 | 61 73 20 61 6c 6c 6f 63 |id UPP w|as alloc|
|00003dd0| 61 74 65 64 0d 0d 73 74 | 61 74 69 63 20 76 6f 69 |ated..st|atic voi|
|00003de0| 64 20 46 61 69 6c 4e 69 | 6c 55 50 50 28 55 6e 69 |d FailNi|lUPP(Uni|
|00003df0| 76 65 72 73 61 6c 50 72 | 6f 63 50 74 72 20 74 68 |versalPr|ocPtr th|
|00003e00| 65 55 50 50 29 0d 7b 0d | 09 69 66 20 28 74 68 65 |eUPP).{.|.if (the|
|00003e10| 55 50 50 20 3d 3d 20 6e | 69 6c 29 0d 09 09 42 69 |UPP == n|il)...Bi|
|00003e20| 67 42 61 64 45 72 72 6f | 72 28 65 4e 6f 4d 65 6d |gBadErro|r(eNoMem|
|00003e30| 6f 72 79 29 3b 0d 7d 0d | 0d 23 69 66 20 71 41 70 |ory);.}.|.#if qAp|
|00003e40| 70 6c 65 45 76 65 6e 74 | 73 0d 0d 2f 2f 20 63 68 |pleEvent|s..// ch|
|00003e50| 65 63 6b 20 74 6f 20 73 | 65 65 20 69 66 20 61 20 |eck to s|ee if a |
|00003e60| 67 69 76 65 6e 20 62 69 | 74 20 69 6e 20 61 20 6c |given bi|t in a l|
|00003e70| 6f 6e 67 20 77 6f 72 64 | 20 69 73 20 73 65 74 2e |ong word| is set.|
|00003e80| 0d 0d 73 74 61 74 69 63 | 20 42 6f 6f 6c 65 61 6e |..static| Boolean|
|00003e90| 20 42 54 73 74 28 6c 6f | 6e 67 20 76 61 6c 75 65 | BTst(lo|ng value|
|00003ea0| 2c 20 73 68 6f 72 74 20 | 62 69 74 29 0d 7b 0d 09 |, short |bit).{..|
|00003eb0| 6c 6f 6e 67 20 6d 61 73 | 6b 20 3d 20 31 4c 20 3c |long mas|k = 1L <|
|00003ec0| 3c 20 62 69 74 3b 0d 09 | 0d 09 72 65 74 75 72 6e |< bit;..|..return|
|00003ed0| 20 28 76 61 6c 75 65 20 | 26 20 6d 61 73 6b 29 20 | (value |& mask) |
|00003ee0| 3d 3d 20 6d 61 73 6b 3b | 0d 7d 0d 0d 23 65 6e 64 |== mask;|.}..#end|
|00003ef0| 69 66 20 2f 2f 20 71 41 | 70 70 6c 65 45 76 65 6e |if // qA|ppleEven|
|00003f00| 74 73 0d 0d 2f 2f 20 63 | 68 65 63 6b 20 74 6f 20 |ts..// c|heck to |
|00003f10| 73 65 65 20 69 66 20 61 | 20 67 69 76 65 6e 20 74 |see if a| given t|
|00003f20| 72 61 70 20 69 73 20 69 | 6d 70 6c 65 6d 65 6e 74 |rap is i|mplement|
|00003f30| 65 64 2e 20 57 65 20 66 | 6f 6c 6c 6f 77 20 49 4d |ed. We f|ollow IM|
|00003f40| 20 56 49 2d 33 2d 38 2e | 0d 0d 42 6f 6f 6c 65 61 | VI-3-8.|..Boolea|
|00003f50| 6e 20 54 72 61 70 41 76 | 61 69 6c 61 62 6c 65 28 |n TrapAv|ailable(|
|00003f60| 73 68 6f 72 74 20 74 68 | 65 54 72 61 70 29 0d 7b |short th|eTrap).{|
|00003f70| 0d 09 54 72 61 70 54 79 | 70 65 20 74 68 65 54 72 |..TrapTy|pe theTr|
|00003f80| 61 70 54 79 70 65 3b 0d | 09 73 68 6f 72 74 20 6e |apType;.|.short n|
|00003f90| 75 6d 54 6f 6f 6c 62 6f | 78 54 72 61 70 73 3b 0d |umToolbo|xTraps;.|
|00003fa0| 09 0d 09 69 66 20 28 28 | 74 68 65 54 72 61 70 20 |...if ((|theTrap |
|00003fb0| 26 20 30 78 30 38 30 30 | 29 20 3e 20 30 29 0d 09 |& 0x0800|) > 0)..|
|00003fc0| 09 74 68 65 54 72 61 70 | 54 79 70 65 20 3d 20 54 |.theTrap|Type = T|
|00003fd0| 6f 6f 6c 54 72 61 70 3b | 0d 09 65 6c 73 65 0d 09 |oolTrap;|..else..|
|00003fe0| 09 74 68 65 54 72 61 70 | 54 79 70 65 20 3d 20 4f |.theTrap|Type = O|
|00003ff0| 53 54 72 61 70 3b 0d 0d | 09 69 66 20 28 74 68 65 |STrap;..|.if (the|
|00004000| 54 72 61 70 54 79 70 65 | 20 3d 3d 20 54 6f 6f 6c |TrapType| == Tool|
|00004010| 54 72 61 70 29 0d 09 7b | 0d 09 09 74 68 65 54 72 |Trap)..{|...theTr|
|00004020| 61 70 20 3d 20 74 68 65 | 54 72 61 70 20 26 20 30 |ap = the|Trap & 0|
|00004030| 78 30 37 66 66 3b 0d 09 | 09 69 66 20 28 4e 47 65 |x07ff;..|.if (NGe|
|00004040| 74 54 72 61 70 41 64 64 | 72 65 73 73 28 5f 49 6e |tTrapAdd|ress(_In|
|00004050| 69 74 47 72 61 66 2c 20 | 54 6f 6f 6c 54 72 61 70 |itGraf, |ToolTrap|
|00004060| 29 20 3d 3d 20 4e 47 65 | 74 54 72 61 70 41 64 64 |) == NGe|tTrapAdd|
|00004070| 72 65 73 73 28 30 78 61 | 61 36 65 2c 20 54 6f 6f |ress(0xa|a6e, Too|
|00004080| 6c 54 72 61 70 29 29 0d | 09 09 09 6e 75 6d 54 6f |lTrap)).|...numTo|
|00004090| 6f 6c 62 6f 78 54 72 61 | 70 73 20 3d 20 30 78 30 |olboxTra|ps = 0x0|
|000040a0| 32 30 30 3b 0d 09 09 65 | 6c 73 65 0d 09 09 09 6e |200;...e|lse....n|
|000040b0| 75 6d 54 6f 6f 6c 62 6f | 78 54 72 61 70 73 20 3d |umToolbo|xTraps =|
|000040c0| 20 30 78 30 34 30 30 3b | 0d 09 09 69 66 20 28 74 | 0x0400;|...if (t|
|000040d0| 68 65 54 72 61 70 20 3e | 3d 20 6e 75 6d 54 6f 6f |heTrap >|= numToo|
|000040e0| 6c 62 6f 78 54 72 61 70 | 73 29 0d 09 09 09 74 68 |lboxTrap|s)....th|
|000040f0| 65 54 72 61 70 20 3d 20 | 5f 55 6e 69 6d 70 6c 65 |eTrap = |_Unimple|
|00004100| 6d 65 6e 74 65 64 3b 0d | 09 7d 0d 0d 09 72 65 74 |mented;.|.}...ret|
|00004110| 75 72 6e 20 28 4e 47 65 | 74 54 72 61 70 41 64 64 |urn (NGe|tTrapAdd|
|00004120| 72 65 73 73 28 74 68 65 | 54 72 61 70 2c 20 74 68 |ress(the|Trap, th|
|00004130| 65 54 72 61 70 54 79 70 | 65 29 20 21 3d 20 4e 47 |eTrapTyp|e) != NG|
|00004140| 65 74 54 72 61 70 41 64 | 64 72 65 73 73 28 5f 55 |etTrapAd|dress(_U|
|00004150| 6e 69 6d 70 6c 65 6d 65 | 6e 74 65 64 2c 20 54 6f |nimpleme|nted, To|
|00004160| 6f 6c 54 72 61 70 29 29 | 3b 0d 7d 0d 0d 23 69 66 |olTrap))|;.}..#if|
|00004170| 20 71 41 70 70 6c 65 45 | 76 65 6e 74 73 0d 0d 73 | qAppleE|vents..s|
|00004180| 74 61 74 69 63 20 76 6f | 69 64 20 43 68 65 63 6b |tatic vo|id Check|
|00004190| 41 70 70 6c 65 45 76 65 | 6e 74 73 28 76 6f 69 64 |AppleEve|nts(void|
|000041a0| 29 0d 7b 0d 09 6c 6f 6e | 67 20 67 65 73 74 61 6c |).{..lon|g gestal|
|000041b0| 74 52 65 73 70 6f 6e 73 | 65 3b 0d 09 0d 09 67 48 |tRespons|e;....gH|
|000041c0| 61 73 41 70 70 6c 65 45 | 76 65 6e 74 73 20 3d 20 |asAppleE|vents = |
|000041d0| 66 61 6c 73 65 3b 0d 09 | 0d 09 69 66 20 28 54 72 |false;..|..if (Tr|
|000041e0| 61 70 41 76 61 69 6c 61 | 62 6c 65 28 5f 47 65 73 |apAvaila|ble(_Ges|
|000041f0| 74 61 6c 74 29 29 0d 09 | 7b 0d 09 09 69 66 20 28 |talt))..|{...if (|
|00004200| 47 65 73 74 61 6c 74 28 | 67 65 73 74 61 6c 74 41 |Gestalt(|gestaltA|
|00004210| 70 70 6c 65 45 76 65 6e | 74 73 41 74 74 72 2c 20 |ppleEven|tsAttr, |
|00004220| 26 67 65 73 74 61 6c 74 | 52 65 73 70 6f 6e 73 65 |&gestalt|Response|
|00004230| 29 20 3d 3d 20 6e 6f 45 | 72 72 29 0d 09 09 09 67 |) == noE|rr)....g|
|00004240| 48 61 73 41 70 70 6c 65 | 45 76 65 6e 74 73 20 3d |HasApple|Events =|
|00004250| 20 42 54 73 74 28 67 65 | 73 74 61 6c 74 52 65 73 | BTst(ge|staltRes|
|00004260| 70 6f 6e 73 65 2c 20 67 | 65 73 74 61 6c 74 41 70 |ponse, g|estaltAp|
|00004270| 70 6c 65 45 76 65 6e 74 | 73 50 72 65 73 65 6e 74 |pleEvent|sPresent|
|00004280| 29 3b 0d 09 7d 0d 7d 0d | 0d 23 69 66 20 71 49 6e |);..}.}.|.#if qIn|
|00004290| 6c 69 6e 65 0d 0d 2f 2f | 20 63 68 65 63 6b 20 77 |line..//| check w|
|000042a0| 68 65 74 68 65 72 20 74 | 68 65 20 54 65 78 74 20 |hether t|he Text |
|000042b0| 53 65 72 76 69 63 65 73 | 20 4d 61 6e 61 67 65 72 |Services| Manager|
|000042c0| 20 61 6e 64 20 74 68 65 | 20 65 78 74 65 6e 73 69 | and the| extensi|
|000042d0| 6f 6e 20 66 6f 72 20 75 | 73 69 6e 67 20 54 65 78 |on for u|sing Tex|
|000042e0| 74 20 53 65 72 76 69 63 | 65 73 20 77 69 74 68 0d |t Servic|es with.|
|000042f0| 2f 2f 20 54 65 78 74 45 | 64 69 74 20 28 54 53 4d |// TextE|dit (TSM|
|00004300| 54 45 29 20 61 72 65 20 | 61 76 61 69 6c 61 62 6c |TE) are |availabl|
|00004310| 65 2c 20 61 6e 64 20 73 | 65 74 73 20 67 48 61 73 |e, and s|ets gHas|
|00004320| 54 65 78 74 53 65 72 76 | 69 63 65 73 20 61 6e 64 |TextServ|ices and|
|00004330| 20 67 48 61 73 54 53 4d | 54 45 20 61 63 63 6f 72 | gHasTSM|TE accor|
|00004340| 64 69 6e 67 6c 79 2e 0d | 0d 73 74 61 74 69 63 20 |dingly..|.static |
|00004350| 76 6f 69 64 20 43 68 65 | 63 6b 46 6f 72 54 65 78 |void Che|ckForTex|
|00004360| 74 53 65 72 76 69 63 65 | 73 28 76 6f 69 64 29 0d |tService|s(void).|
|00004370| 7b 0d 09 6c 6f 6e 67 20 | 67 65 73 74 61 6c 74 52 |{..long |gestaltR|
|00004380| 65 73 70 6f 6e 73 65 3b | 0d 09 0d 09 67 48 61 73 |esponse;|....gHas|
|00004390| 54 65 78 74 53 65 72 76 | 69 63 65 73 20 3d 20 66 |TextServ|ices = f|
|000043a0| 61 6c 73 65 3b 09 09 2f | 2f 20 75 6e 6c 65 73 73 |alse;../|/ unless|
|000043b0| 20 70 72 6f 76 65 6e 20 | 6f 74 68 65 72 77 69 73 | proven |otherwis|
|000043c0| 65 0d 09 67 48 61 73 54 | 53 4d 54 45 20 3d 20 66 |e..gHasT|SMTE = f|
|000043d0| 61 6c 73 65 3b 09 09 09 | 09 2f 2f 20 75 6e 6c 65 |alse;...|.// unle|
|000043e0| 73 73 20 70 72 6f 76 65 | 6e 20 6f 74 68 65 72 77 |ss prove|n otherw|
|000043f0| 69 73 65 0d 09 0d 09 69 | 66 20 28 54 72 61 70 41 |ise....i|f (TrapA|
|00004400| 76 61 69 6c 61 62 6c 65 | 28 5f 47 65 73 74 61 6c |vailable|(_Gestal|
|00004410| 74 29 29 0d 09 7b 0d 09 | 09 69 66 20 28 28 47 65 |t))..{..|.if ((Ge|
|00004420| 73 74 61 6c 74 28 67 65 | 73 74 61 6c 74 54 53 4d |stalt(ge|staltTSM|
|00004430| 67 72 56 65 72 73 69 6f | 6e 2c 20 26 67 65 73 74 |grVersio|n, &gest|
|00004440| 61 6c 74 52 65 73 70 6f | 6e 73 65 29 20 3d 3d 20 |altRespo|nse) == |
|00004450| 6e 6f 45 72 72 29 20 26 | 26 20 28 67 65 73 74 61 |noErr) &|& (gesta|
|00004460| 6c 74 52 65 73 70 6f 6e | 73 65 20 3e 3d 20 31 29 |ltRespon|se >= 1)|
|00004470| 29 0d 09 09 7b 0d 09 09 | 09 67 48 61 73 54 65 78 |)...{...|.gHasTex|
|00004480| 74 53 65 72 76 69 63 65 | 73 20 3d 20 74 72 75 65 |tService|s = true|
|00004490| 3b 0d 09 09 09 69 66 20 | 28 47 65 73 74 61 6c 74 |;....if |(Gestalt|
|000044a0| 28 67 65 73 74 61 6c 74 | 54 53 4d 54 45 41 74 74 |(gestalt|TSMTEAtt|
|000044b0| 72 2c 20 26 67 65 73 74 | 61 6c 74 52 65 73 70 6f |r, &gest|altRespo|
|000044c0| 6e 73 65 29 20 3d 3d 20 | 6e 6f 45 72 72 29 0d 09 |nse) == |noErr)..|
|000044d0| 09 09 09 67 48 61 73 54 | 53 4d 54 45 20 3d 20 42 |...gHasT|SMTE = B|
|000044e0| 54 73 74 28 67 65 73 74 | 61 6c 74 52 65 73 70 6f |Tst(gest|altRespo|
|000044f0| 6e 73 65 2c 20 67 65 73 | 74 61 6c 74 54 53 4d 54 |nse, ges|taltTSMT|
|00004500| 45 50 72 65 73 65 6e 74 | 29 3b 0d 09 09 7d 0d 09 |EPresent|);...}..|
|00004510| 7d 0d 7d 0d 0d 23 65 6e | 64 69 66 20 2f 2f 20 71 |}.}..#en|dif // q|
|00004520| 49 6e 6c 69 6e 65 0d 23 | 65 6e 64 69 66 20 2f 2f |Inline.#|endif //|
|00004530| 20 71 41 70 70 6c 65 45 | 76 65 6e 74 73 0d 0d 76 | qAppleE|vents..v|
|00004540| 6f 69 64 20 6d 61 69 6e | 28 76 6f 69 64 29 0d 7b |oid main|(void).{|
|00004550| 0d 09 2f 2a 09 49 66 20 | 79 6f 75 20 68 61 76 65 |../*.If |you have|
|00004560| 20 73 74 61 63 6b 20 72 | 65 71 75 69 72 65 6d 65 | stack r|equireme|
|00004570| 6e 74 73 20 74 68 61 74 | 20 64 69 66 66 65 72 20 |nts that| differ |
|00004580| 66 72 6f 6d 20 74 68 65 | 20 64 65 66 61 75 6c 74 |from the| default|
|00004590| 2c 0d 09 09 74 68 65 6e | 20 79 6f 75 20 63 6f 75 |,...then| you cou|
|000045a0| 6c 64 20 75 73 65 20 53 | 65 74 41 70 70 6c 4c 69 |ld use S|etApplLi|
|000045b0| 6d 69 74 20 74 6f 20 69 | 6e 63 72 65 61 73 65 20 |mit to i|ncrease |
|000045c0| 53 74 61 63 6b 53 70 61 | 63 65 20 61 74 20 0d 09 |StackSpa|ce at ..|
|000045d0| 09 74 68 69 73 20 70 6f | 69 6e 74 2c 20 62 65 66 |.this po|int, bef|
|000045e0| 6f 72 65 20 63 61 6c 6c | 69 6e 67 20 4d 61 78 41 |ore call|ing MaxA|
|000045f0| 70 70 6c 5a 6f 6e 65 2e | 20 2a 2f 0d 09 4d 61 78 |pplZone.| */..Max|
|00004600| 41 70 70 6c 5a 6f 6e 65 | 28 29 3b 09 09 09 09 09 |ApplZone|();.....|
|00004610| 2f 2a 20 65 78 70 61 6e | 64 20 74 68 65 20 68 65 |/* expan|d the he|
|00004620| 61 70 20 2a 2f 0d 0d 09 | 49 6e 69 74 69 61 6c 69 |ap */...|Initiali|
|00004630| 7a 65 28 29 3b 09 09 09 | 09 09 2f 2a 20 69 6e 69 |ze();...|../* ini|
|00004640| 74 69 61 6c 69 7a 65 20 | 74 68 65 20 70 72 6f 67 |tialize |the prog|
|00004650| 72 61 6d 20 2a 2f 0d 23 | 69 66 20 71 41 70 70 6c |ram */.#|if qAppl|
|00004660| 65 45 76 65 6e 74 73 0d | 09 69 66 20 28 21 67 48 |eEvents.|.if (!gH|
|00004670| 61 73 41 70 70 6c 65 45 | 76 65 6e 74 73 29 0d 09 |asAppleE|vents)..|
|00004680| 09 44 6f 4e 65 77 28 29 | 3b 0d 23 65 6c 73 65 20 |.DoNew()|;.#else |
|00004690| 2f 2f 20 71 41 70 70 6c | 65 45 76 65 6e 74 73 0d |// qAppl|eEvents.|
|000046a0| 09 44 6f 4e 65 77 28 29 | 3b 0d 23 65 6e 64 69 66 |.DoNew()|;.#endif|
|000046b0| 20 2f 2f 20 71 41 70 70 | 6c 65 45 76 65 6e 74 73 | // qApp|leEvents|
|000046c0| 0d 0d 09 45 76 65 6e 74 | 4c 6f 6f 70 28 29 3b 09 |...Event|Loop();.|
|000046d0| 09 09 09 09 2f 2a 20 63 | 61 6c 6c 20 74 68 65 20 |..../* c|all the |
|000046e0| 6d 61 69 6e 20 65 76 65 | 6e 74 20 6c 6f 6f 70 20 |main eve|nt loop |
|000046f0| 2a 2f 0d 0d 23 69 66 20 | 71 41 70 70 6c 65 45 76 |*/..#if |qAppleEv|
|00004700| 65 6e 74 73 0d 23 69 66 | 20 71 49 6e 6c 69 6e 65 |ents.#if| qInline|
|00004710| 0d 09 45 78 69 74 41 70 | 70 6c 69 63 61 74 69 6f |..ExitAp|plicatio|
|00004720| 6e 28 29 3b 0d 23 65 6c | 73 65 20 2f 2f 20 71 49 |n();.#el|se // qI|
|00004730| 6e 6c 69 6e 65 0d 09 45 | 78 69 74 54 6f 53 68 65 |nline..E|xitToShe|
|00004740| 6c 6c 28 29 3b 0d 23 65 | 6e 64 69 66 20 2f 2f 20 |ll();.#e|ndif // |
|00004750| 71 49 6e 6c 69 6e 65 0d | 23 65 6e 64 69 66 20 2f |qInline.|#endif /|
|00004760| 2f 20 71 41 70 70 6c 65 | 45 76 65 6e 74 73 0d 7d |/ qApple|Events.}|
|00004770| 0d 0d 23 69 66 20 71 49 | 6e 6c 69 6e 65 0d 0d 73 |..#if qI|nline..s|
|00004780| 74 61 74 69 63 20 42 6f | 6f 6c 65 61 6e 20 49 6e |tatic Bo|olean In|
|00004790| 74 6c 54 53 4d 45 76 65 | 6e 74 28 45 76 65 6e 74 |tlTSMEve|nt(Event|
|000047a0| 52 65 63 6f 72 64 20 2a | 65 76 65 6e 74 29 0d 7b |Record *|event).{|
|000047b0| 0d 09 73 68 6f 72 74 20 | 6f 6c 64 46 6f 6e 74 3b |..short |oldFont;|
|000047c0| 0d 09 53 63 72 69 70 74 | 43 6f 64 65 20 6b 65 79 |..Script|Code key|
|000047d0| 62 6f 61 72 64 53 63 72 | 69 70 74 3b 0d 09 0d 09 |boardScr|ipt;....|
|000047e0| 2f 2f 20 6d 61 6b 65 20 | 73 75 72 65 20 77 65 20 |// make |sure we |
|000047f0| 68 61 76 65 20 61 20 70 | 6f 72 74 20 61 6e 64 20 |have a p|ort and |
|00004800| 69 74 27 73 20 6e 6f 74 | 20 74 68 65 20 57 69 6e |it's not| the Win|
|00004810| 64 6f 77 20 4d 61 6e 61 | 67 65 72 20 70 6f 72 74 |dow Mana|ger port|
|00004820| 0d 09 69 66 20 28 71 64 | 2e 74 68 65 50 6f 72 74 |..if (qd|.thePort|
|00004830| 20 21 3d 20 6e 69 6c 20 | 26 26 20 46 72 6f 6e 74 | != nil |&& Front|
|00004840| 57 69 6e 64 6f 77 28 29 | 20 21 3d 20 6e 69 6c 29 |Window()| != nil)|
|00004850| 0d 09 7b 0d 09 09 6f 6c | 64 46 6f 6e 74 20 3d 20 |..{...ol|dFont = |
|00004860| 71 64 2e 74 68 65 50 6f | 72 74 2d 3e 74 78 46 6f |qd.thePo|rt->txFo|
|00004870| 6e 74 3b 0d 09 09 6b 65 | 79 62 6f 61 72 64 53 63 |nt;...ke|yboardSc|
|00004880| 72 69 70 74 20 3d 20 47 | 65 74 53 63 72 69 70 74 |ript = G|etScript|
|00004890| 4d 61 6e 61 67 65 72 56 | 61 72 69 61 62 6c 65 28 |ManagerV|ariable(|
|000048a0| 73 6d 4b 65 79 53 63 72 | 69 70 74 29 3b 0d 09 09 |smKeyScr|ipt);...|
|000048b0| 69 66 20 28 46 6f 6e 74 | 54 6f 53 63 72 69 70 74 |if (Font|ToScript|
|000048c0| 28 6f 6c 64 46 6f 6e 74 | 29 20 21 3d 20 6b 65 79 |(oldFont|) != key|
|000048d0| 62 6f 61 72 64 53 63 72 | 69 70 74 29 0d 09 09 09 |boardScr|ipt)....|
|000048e0| 54 65 78 74 46 6f 6e 74 | 28 47 65 74 53 63 72 69 |TextFont|(GetScri|
|000048f0| 70 74 56 61 72 69 61 62 | 6c 65 28 6b 65 79 62 6f |ptVariab|le(keybo|
|00004900| 61 72 64 53 63 72 69 70 | 74 2c 20 73 6d 53 63 72 |ardScrip|t, smScr|
|00004910| 69 70 74 41 70 70 46 6f | 6e 64 29 29 3b 0d 09 7d |iptAppFo|nd));..}|
|00004920| 0d 09 72 65 74 75 72 6e | 20 54 53 4d 45 76 65 6e |..return| TSMEven|
|00004930| 74 28 65 76 65 6e 74 29 | 3b 0d 7d 0d 0d 23 65 6e |t(event)|;.}..#en|
|00004940| 64 69 66 20 2f 2f 20 71 | 49 6e 6c 69 6e 65 0d 0d |dif // q|Inline..|
|00004950| 2f 2a 20 47 65 74 20 65 | 76 65 6e 74 73 20 66 6f |/* Get e|vents fo|
|00004960| 72 65 76 65 72 2c 20 61 | 6e 64 20 68 61 6e 64 6c |rever, a|nd handl|
|00004970| 65 20 74 68 65 6d 20 62 | 79 20 63 61 6c 6c 69 6e |e them b|y callin|
|00004980| 67 20 44 6f 45 76 65 6e | 74 2e 0d 20 20 20 41 6c |g DoEven|t.. Al|
|00004990| 73 6f 20 63 61 6c 6c 20 | 41 64 6a 75 73 74 43 75 |so call |AdjustCu|
|000049a0| 72 73 6f 72 20 65 61 63 | 68 20 74 69 6d 65 20 74 |rsor eac|h time t|
|000049b0| 68 72 6f 75 67 68 20 74 | 68 65 20 6c 6f 6f 70 2e |hrough t|he loop.|
|000049c0| 20 2a 2f 0d 0d 76 6f 69 | 64 20 45 76 65 6e 74 4c | */..voi|d EventL|
|000049d0| 6f 6f 70 28 76 6f 69 64 | 29 0d 7b 0d 09 52 67 6e |oop(void|).{..Rgn|
|000049e0| 48 61 6e 64 6c 65 09 63 | 75 72 73 6f 72 52 67 6e |Handle.c|ursorRgn|
|000049f0| 3b 0d 09 42 6f 6f 6c 65 | 61 6e 09 09 67 6f 74 45 |;..Boole|an..gotE|
|00004a00| 76 65 6e 74 3b 0d 23 69 | 66 20 71 49 6e 6c 69 6e |vent;.#i|f qInlin|
|00004a10| 65 0d 09 42 6f 6f 6c 65 | 61 6e 09 09 68 61 6e 64 |e..Boole|an..hand|
|00004a20| 6c 65 64 42 79 54 53 4d | 3b 0d 23 65 6e 64 69 66 |ledByTSM|;.#endif|
|00004a30| 0d 09 45 76 65 6e 74 52 | 65 63 6f 72 64 09 65 76 |..EventR|ecord.ev|
|00004a40| 65 6e 74 3b 0d 09 50 6f | 69 6e 74 09 09 6d 6f 75 |ent;..Po|int..mou|
|00004a50| 73 65 3b 0d 0d 09 63 75 | 72 73 6f 72 52 67 6e 20 |se;...cu|rsorRgn |
|00004a60| 3d 20 4e 65 77 52 67 6e | 28 29 3b 09 09 09 2f 2a |= NewRgn|();.../*|
|00004a70| 20 77 65 d5 6c 6c 20 70 | 61 73 73 20 57 4e 45 20 | we.ll p|ass WNE |
|00004a80| 61 6e 20 65 6d 70 74 79 | 20 72 65 67 69 6f 6e 20 |an empty| region |
|00004a90| 74 68 65 20 31 73 74 20 | 74 69 6d 65 20 74 68 72 |the 1st |time thr|
|00004aa0| 75 20 2a 2f 0d 23 69 66 | 20 71 41 70 70 6c 65 45 |u */.#if| qAppleE|
|00004ab0| 76 65 6e 74 73 0d 09 77 | 68 69 6c 65 20 28 21 67 |vents..w|hile (!g|
|00004ac0| 51 75 69 74 74 69 6e 67 | 29 0d 23 65 6c 73 65 20 |Quitting|).#else |
|00004ad0| 2f 2f 20 71 41 70 70 6c | 65 45 76 65 6e 74 73 0d |// qAppl|eEvents.|
|00004ae0| 09 77 68 69 6c 65 20 28 | 74 72 75 65 29 20 2f 2f |.while (|true) //|
|00004af0| 20 6c 6f 6f 70 20 66 6f | 72 65 76 65 72 2c 20 71 | loop fo|rever, q|
|00004b00| 75 69 74 20 76 69 61 20 | 45 78 69 74 54 6f 53 68 |uit via |ExitToSh|
|00004b10| 65 6c 6c 0d 23 65 6e 64 | 69 66 20 2f 2f 20 71 41 |ell.#end|if // qA|
|00004b20| 70 70 6c 65 45 76 65 6e | 74 73 0d 09 7b 0d 23 69 |ppleEven|ts..{.#i|
|00004b30| 66 20 71 49 6e 6c 69 6e | 65 0d 09 09 2f 2f 20 73 |f qInlin|e...// s|
|00004b40| 65 74 20 67 6c 6f 62 61 | 6c 20 66 6f 6e 74 46 6f |et globa|l fontFo|
|00004b50| 72 63 65 20 66 6c 61 67 | 20 73 6f 20 6f 74 68 65 |rce flag| so othe|
|00004b60| 72 20 61 70 70 73 20 64 | 6f 6e 27 74 20 67 65 74 |r apps d|on't get|
|00004b70| 20 63 6f 6e 66 75 73 65 | 64 0d 09 09 28 76 6f 69 | confuse|d...(voi|
|00004b80| 64 29 20 53 65 74 53 63 | 72 69 70 74 4d 61 6e 61 |d) SetSc|riptMana|
|00004b90| 67 65 72 56 61 72 69 61 | 62 6c 65 28 73 6d 46 6f |gerVaria|ble(smFo|
|00004ba0| 6e 74 46 6f 72 63 65 2c | 20 67 53 61 76 65 64 46 |ntForce,| gSavedF|
|00004bb0| 6f 6e 74 46 6f 72 63 65 | 29 3b 0d 09 09 0d 23 65 |ontForce|);....#e|
|00004bc0| 6e 64 69 66 20 2f 2f 20 | 71 49 6e 6c 69 6e 65 0d |ndif // |qInline.|
|00004bd0| 09 09 2f 2a 20 75 73 65 | 20 57 4e 45 20 69 66 20 |../* use| WNE if |
|00004be0| 69 74 20 69 73 20 61 76 | 61 69 6c 61 62 6c 65 20 |it is av|ailable |
|00004bf0| 2a 2f 0d 09 09 69 66 20 | 28 20 67 48 61 73 57 61 |*/...if |( gHasWa|
|00004c00| 69 74 4e 65 78 74 45 76 | 65 6e 74 20 29 20 7b 0d |itNextEv|ent ) {.|
|00004c10| 09 09 09 47 65 74 47 6c | 6f 62 61 6c 4d 6f 75 73 |...GetGl|obalMous|
|00004c20| 65 28 26 6d 6f 75 73 65 | 29 3b 0d 09 09 09 41 64 |e(&mouse|);....Ad|
|00004c30| 6a 75 73 74 43 75 72 73 | 6f 72 28 6d 6f 75 73 65 |justCurs|or(mouse|
|00004c40| 2c 20 63 75 72 73 6f 72 | 52 67 6e 29 3b 0d 09 09 |, cursor|Rgn);...|
|00004c50| 09 67 6f 74 45 76 65 6e | 74 20 3d 20 57 61 69 74 |.gotEven|t = Wait|
|00004c60| 4e 65 78 74 45 76 65 6e | 74 28 65 76 65 72 79 45 |NextEven|t(everyE|
|00004c70| 76 65 6e 74 2c 20 26 65 | 76 65 6e 74 2c 20 47 65 |vent, &e|vent, Ge|
|00004c80| 74 53 6c 65 65 70 28 29 | 2c 20 63 75 72 73 6f 72 |tSleep()|, cursor|
|00004c90| 52 67 6e 29 3b 0d 09 09 | 7d 0d 09 09 65 6c 73 65 |Rgn);...|}...else|
|00004ca0| 20 7b 0d 09 09 09 53 79 | 73 74 65 6d 54 61 73 6b | {....Sy|stemTask|
|00004cb0| 28 29 3b 0d 09 09 09 67 | 6f 74 45 76 65 6e 74 20 |();....g|otEvent |
|00004cc0| 3d 20 47 65 74 4e 65 78 | 74 45 76 65 6e 74 28 65 |= GetNex|tEvent(e|
|00004cd0| 76 65 72 79 45 76 65 6e | 74 2c 20 26 65 76 65 6e |veryEven|t, &even|
|00004ce0| 74 29 3b 0d 09 09 7d 0d | 0d 23 69 66 20 71 49 6e |t);...}.|.#if qIn|
|00004cf0| 6c 69 6e 65 0d 09 09 2f | 2f 20 63 6c 65 61 72 20 |line.../|/ clear |
|00004d00| 66 6f 6e 74 46 6f 72 63 | 65 20 61 67 61 69 6e 20 |fontForc|e again |
|00004d10| 73 6f 20 69 74 20 64 6f | 65 73 6e 27 74 20 75 70 |so it do|esn't up|
|00004d20| 73 65 74 20 6f 75 72 20 | 6f 70 65 72 61 74 69 6f |set our |operatio|
|00004d30| 6e 73 0d 09 09 67 53 61 | 76 65 64 46 6f 6e 74 46 |ns...gSa|vedFontF|
|00004d40| 6f 72 63 65 20 3d 20 47 | 65 74 53 63 72 69 70 74 |orce = G|etScript|
|00004d50| 4d 61 6e 61 67 65 72 56 | 61 72 69 61 62 6c 65 28 |ManagerV|ariable(|
|00004d60| 73 6d 46 6f 6e 74 46 6f | 72 63 65 29 3b 0d 09 09 |smFontFo|rce);...|
|00004d70| 28 76 6f 69 64 29 20 53 | 65 74 53 63 72 69 70 74 |(void) S|etScript|
|00004d80| 4d 61 6e 61 67 65 72 56 | 61 72 69 61 62 6c 65 28 |ManagerV|ariable(|
|00004d90| 73 6d 46 6f 6e 74 46 6f | 72 63 65 2c 20 30 29 3b |smFontFo|rce, 0);|
|00004da0| 0d 09 09 0d 09 09 69 66 | 20 28 67 48 61 73 54 65 |......if| (gHasTe|
|00004db0| 78 74 53 65 72 76 69 63 | 65 73 29 0d 09 09 7b 0d |xtServic|es)...{.|
|00004dc0| 09 09 09 2f 2a 20 77 65 | 20 6e 65 65 64 20 74 6f |.../* we| need to|
|00004dd0| 20 63 61 6c 6c 20 49 6e | 74 6c 54 53 4d 45 76 65 | call In|tlTSMEve|
|00004de0| 6e 74 20 65 76 65 6e 20 | 66 6f 72 20 4e 55 4c 4c |nt even |for NULL|
|00004df0| 20 65 76 65 6e 74 73 20 | 2a 2f 0d 09 09 09 68 61 | events |*/....ha|
|00004e00| 6e 64 6c 65 64 42 79 54 | 53 4d 20 3d 20 49 6e 74 |ndledByT|SM = Int|
|00004e10| 6c 54 53 4d 45 76 65 6e | 74 28 26 65 76 65 6e 74 |lTSMEven|t(&event|
|00004e20| 29 3b 0d 09 09 09 69 66 | 20 28 21 68 61 6e 64 6c |);....if| (!handl|
|00004e30| 65 64 42 79 54 53 4d 20 | 26 26 20 67 6f 74 45 76 |edByTSM |&& gotEv|
|00004e40| 65 6e 74 29 0d 09 09 09 | 7b 0d 09 09 09 09 2f 2a |ent)....|{...../*|
|00004e50| 20 6d 61 6b 65 20 73 75 | 72 65 20 77 65 20 68 61 | make su|re we ha|
|00004e60| 76 65 20 74 68 65 20 72 | 69 67 68 74 20 63 75 72 |ve the r|ight cur|
|00004e70| 73 6f 72 20 62 65 66 6f | 72 65 20 68 61 6e 64 6c |sor befo|re handl|
|00004e80| 69 6e 67 20 74 68 65 20 | 65 76 65 6e 74 20 2a 2f |ing the |event */|
|00004e90| 0d 09 09 09 09 41 64 6a | 75 73 74 43 75 72 73 6f |.....Adj|ustCurso|
|00004ea0| 72 28 65 76 65 6e 74 2e | 77 68 65 72 65 2c 20 63 |r(event.|where, c|
|00004eb0| 75 72 73 6f 72 52 67 6e | 29 3b 0d 09 09 09 09 44 |ursorRgn|);.....D|
|00004ec0| 6f 45 76 65 6e 74 28 26 | 65 76 65 6e 74 29 3b 0d |oEvent(&|event);.|
|00004ed0| 09 09 09 7d 0d 09 09 09 | 65 6c 73 65 20 0d 09 09 |...}....|else ...|
|00004ee0| 09 7b 0d 09 09 09 09 44 | 6f 49 64 6c 65 28 29 3b |.{.....D|oIdle();|
|00004ef0| 0d 09 09 09 7d 0d 09 09 | 7d 0d 09 09 65 6c 73 65 |....}...|}...else|
|00004f00| 20 20 20 20 2f 2f 20 6e | 6f 20 49 6e 6c 69 6e 65 | // n|o Inline|
|00004f10| 49 6e 70 75 74 20 63 61 | 73 65 0d 09 09 7b 0d 09 |Input ca|se...{..|
|00004f20| 09 09 69 66 20 28 67 6f | 74 45 76 65 6e 74 29 0d |..if (go|tEvent).|
|00004f30| 09 09 09 7b 0d 09 09 09 | 09 2f 2a 20 6d 61 6b 65 |...{....|./* make|
|00004f40| 20 73 75 72 65 20 77 65 | 20 68 61 76 65 20 74 68 | sure we| have th|
|00004f50| 65 20 72 69 67 68 74 20 | 63 75 72 73 6f 72 20 62 |e right |cursor b|
|00004f60| 65 66 6f 72 65 20 68 61 | 6e 64 6c 69 6e 67 20 74 |efore ha|ndling t|
|00004f70| 68 65 20 65 76 65 6e 74 | 20 2a 2f 0d 09 09 09 09 |he event| */.....|
|00004f80| 41 64 6a 75 73 74 43 75 | 72 73 6f 72 28 65 76 65 |AdjustCu|rsor(eve|
|00004f90| 6e 74 2e 77 68 65 72 65 | 2c 20 63 75 72 73 6f 72 |nt.where|, cursor|
|00004fa0| 52 67 6e 29 3b 0d 09 09 | 09 09 44 6f 45 76 65 6e |Rgn);...|..DoEven|
|00004fb0| 74 28 26 65 76 65 6e 74 | 29 3b 0d 09 09 09 7d 0d |t(&event|);....}.|
|00004fc0| 09 09 09 65 6c 73 65 0d | 09 09 09 7b 0d 09 09 09 |...else.|...{....|
|00004fd0| 09 44 6f 49 64 6c 65 28 | 29 3b 0d 09 09 09 7d 0d |.DoIdle(|);....}.|
|00004fe0| 09 09 7d 0d 09 09 09 0d | 23 65 6c 73 65 20 2f 2f |..}.....|#else //|
|00004ff0| 20 71 49 6e 6c 69 6e 65 | 0d 09 09 69 66 20 28 20 | qInline|...if ( |
|00005000| 67 6f 74 45 76 65 6e 74 | 20 29 0d 09 09 7b 0d 09 |gotEvent| )...{..|
|00005010| 09 09 2f 2a 20 6d 61 6b | 65 20 73 75 72 65 20 77 |../* mak|e sure w|
|00005020| 65 20 68 61 76 65 20 74 | 68 65 20 72 69 67 68 74 |e have t|he right|
|00005030| 20 63 75 72 73 6f 72 20 | 62 65 66 6f 72 65 20 68 | cursor |before h|
|00005040| 61 6e 64 6c 69 6e 67 20 | 74 68 65 20 65 76 65 6e |andling |the even|
|00005050| 74 20 2a 2f 0d 09 09 09 | 41 64 6a 75 73 74 43 75 |t */....|AdjustCu|
|00005060| 72 73 6f 72 28 65 76 65 | 6e 74 2e 77 68 65 72 65 |rsor(eve|nt.where|
|00005070| 2c 20 63 75 72 73 6f 72 | 52 67 6e 29 3b 0d 09 09 |, cursor|Rgn);...|
|00005080| 09 44 6f 45 76 65 6e 74 | 28 26 65 76 65 6e 74 29 |.DoEvent|(&event)|
|00005090| 3b 0d 09 09 7d 0d 09 09 | 65 6c 73 65 0d 09 09 09 |;...}...|else....|
|000050a0| 44 6f 49 64 6c 65 28 29 | 3b 09 09 09 09 2f 2a 20 |DoIdle()|;..../* |
|000050b0| 70 65 72 66 6f 72 6d 20 | 69 64 6c 65 20 74 61 73 |perform |idle tas|
|000050c0| 6b 73 20 77 68 65 6e 20 | 69 74 d5 73 20 6e 6f 74 |ks when |it.s not|
|000050d0| 20 6f 75 72 20 65 76 65 | 6e 74 20 2a 2f 0d 09 09 | our eve|nt */...|
|000050e0| 2f 2a 09 49 66 20 79 6f | 75 20 61 72 65 20 75 73 |/*.If yo|u are us|
|000050f0| 69 6e 67 20 6d 6f 64 65 | 6c 65 73 73 20 64 69 61 |ing mode|less dia|
|00005100| 6c 6f 67 73 20 74 68 61 | 74 20 68 61 76 65 20 65 |logs tha|t have e|
|00005110| 64 69 74 54 65 78 74 20 | 69 74 65 6d 73 2c 0d 09 |ditText |items,..|
|00005120| 09 09 79 6f 75 20 77 69 | 6c 6c 20 77 61 6e 74 20 |..you wi|ll want |
|00005130| 74 6f 20 63 61 6c 6c 20 | 49 73 44 69 61 6c 6f 67 |to call |IsDialog|
|00005140| 45 76 65 6e 74 20 74 6f | 20 67 69 76 65 20 74 68 |Event to| give th|
|00005150| 65 20 63 61 72 65 74 20 | 61 20 63 68 61 6e 63 65 |e caret |a chance|
|00005160| 0d 09 09 09 74 6f 20 62 | 6c 69 6e 6b 2c 20 65 76 |....to b|link, ev|
|00005170| 65 6e 20 69 66 20 57 4e | 45 2f 47 4e 45 20 72 65 |en if WN|E/GNE re|
|00005180| 74 75 72 6e 65 64 20 46 | 41 4c 53 45 2e 20 48 6f |turned F|ALSE. Ho|
|00005190| 77 65 76 65 72 2c 20 63 | 68 65 63 6b 20 46 72 6f |wever, c|heck Fro|
|000051a0| 6e 74 57 69 6e 64 6f 77 | 0d 09 09 09 66 6f 72 20 |ntWindow|....for |
|000051b0| 61 20 6e 6f 6e 2d 4e 49 | 4c 20 76 61 6c 75 65 20 |a non-NI|L value |
|000051c0| 62 65 66 6f 72 65 20 63 | 61 6c 6c 69 6e 67 20 49 |before c|alling I|
|000051d0| 73 44 69 61 6c 6f 67 45 | 76 65 6e 74 2e 20 2a 2f |sDialogE|vent. */|
|000051e0| 0d 23 65 6e 64 69 66 0d | 09 7d 0d 7d 0d 0d 0d 2f |.#endif.|.}.}.../|
|000051f0| 2a 20 44 6f 20 74 68 65 | 20 72 69 67 68 74 20 74 |* Do the| right t|
|00005200| 68 69 6e 67 20 66 6f 72 | 20 61 6e 20 65 76 65 6e |hing for| an even|
|00005210| 74 2e 20 44 65 74 65 72 | 6d 69 6e 65 20 77 68 61 |t. Deter|mine wha|
|00005220| 74 20 6b 69 6e 64 20 6f | 66 20 65 76 65 6e 74 20 |t kind o|f event |
|00005230| 69 74 20 69 73 2c 20 61 | 6e 64 20 63 61 6c 6c 0d |it is, a|nd call.|
|00005240| 20 74 68 65 20 61 70 70 | 72 6f 70 72 69 61 74 65 | the app|ropriate|
|00005250| 20 72 6f 75 74 69 6e 65 | 73 2e 20 2a 2f 0d 0d 76 | routine|s. */..v|
|00005260| 6f 69 64 20 44 6f 45 76 | 65 6e 74 28 45 76 65 6e |oid DoEv|ent(Even|
|00005270| 74 52 65 63 6f 72 64 20 | 2a 65 76 65 6e 74 29 0d |tRecord |*event).|
|00005280| 7b 0d 09 73 68 6f 72 74 | 09 09 70 61 72 74 2c 20 |{..short|..part, |
|00005290| 65 72 72 3b 0d 09 57 69 | 6e 64 6f 77 50 74 72 09 |err;..Wi|ndowPtr.|
|000052a0| 77 69 6e 64 6f 77 3b 0d | 09 63 68 61 72 09 09 6b |window;.|.char..k|
|000052b0| 65 79 3b 0d 09 50 6f 69 | 6e 74 09 09 61 50 6f 69 |ey;..Poi|nt..aPoi|
|000052c0| 6e 74 3b 0d 23 69 66 20 | 71 49 6e 6c 69 6e 65 0d |nt;.#if |qInline.|
|000052d0| 09 6c 6f 6e 67 09 09 6d | 65 6e 75 52 65 73 75 6c |.long..m|enuResul|
|000052e0| 74 3b 0d 23 65 6e 64 69 | 66 20 2f 2f 20 71 49 6e |t;.#endi|f // qIn|
|000052f0| 6c 69 6e 65 0d 0d 09 73 | 77 69 74 63 68 20 28 20 |line...s|witch ( |
|00005300| 65 76 65 6e 74 2d 3e 77 | 68 61 74 20 29 20 7b 0d |event->w|hat ) {.|
|00005310| 09 09 63 61 73 65 20 6e | 75 6c 6c 45 76 65 6e 74 |..case n|ullEvent|
|00005320| 3a 0d 09 09 09 2f 2a 20 | 77 65 20 69 64 6c 65 20 |:..../* |we idle |
|00005330| 66 6f 72 20 6e 75 6c 6c | 2f 6d 6f 75 73 65 20 6d |for null|/mouse m|
|00005340| 6f 76 65 64 20 65 76 65 | 6e 74 73 20 61 6e 64 73 |oved eve|nts ands|
|00005350| 20 66 6f 72 20 65 76 65 | 6e 74 73 20 77 68 69 63 | for eve|nts whic|
|00005360| 68 20 61 72 65 6e d5 74 | 0d 09 09 09 09 6f 75 72 |h aren.t|.....our|
|00005370| 73 20 28 73 65 65 20 45 | 76 65 6e 74 4c 6f 6f 70 |s (see E|ventLoop|
|00005380| 29 20 2a 2f 0d 09 09 09 | 44 6f 49 64 6c 65 28 29 |) */....|DoIdle()|
|00005390| 3b 0d 09 09 09 62 72 65 | 61 6b 3b 0d 09 09 63 61 |;....bre|ak;...ca|
|000053a0| 73 65 20 6d 6f 75 73 65 | 44 6f 77 6e 3a 0d 09 09 |se mouse|Down:...|
|000053b0| 09 70 61 72 74 20 3d 20 | 46 69 6e 64 57 69 6e 64 |.part = |FindWind|
|000053c0| 6f 77 28 65 76 65 6e 74 | 2d 3e 77 68 65 72 65 2c |ow(event|->where,|
|000053d0| 20 26 77 69 6e 64 6f 77 | 29 3b 0d 09 09 09 73 77 | &window|);....sw|
|000053e0| 69 74 63 68 20 28 20 70 | 61 72 74 20 29 20 7b 0d |itch ( p|art ) {.|
|000053f0| 09 09 09 09 63 61 73 65 | 20 69 6e 4d 65 6e 75 42 |....case| inMenuB|
|00005400| 61 72 3a 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |ar: | |
|00005410| 2f 2a 20 70 72 6f 63 65 | 73 73 20 61 20 6d 6f 75 |/* proce|ss a mou|
|00005420| 73 65 20 6d 65 6e 75 20 | 63 6f 6d 6d 61 6e 64 20 |se menu |command |
|00005430| 28 69 66 20 61 6e 79 29 | 20 2a 2f 0d 09 09 09 09 |(if any)| */.....|
|00005440| 09 41 64 6a 75 73 74 4d | 65 6e 75 73 28 29 3b 0d |.AdjustM|enus();.|
|00005450| 23 69 66 20 71 49 6e 6c | 69 6e 65 0d 09 09 09 09 |#if qInl|ine.....|
|00005460| 09 6d 65 6e 75 52 65 73 | 75 6c 74 20 3d 20 4d 65 |.menuRes|ult = Me|
|00005470| 6e 75 53 65 6c 65 63 74 | 28 65 76 65 6e 74 2d 3e |nuSelect|(event->|
|00005480| 77 68 65 72 65 29 3b 0d | 09 09 09 09 09 69 66 20 |where);.|.....if |
|00005490| 28 21 28 67 48 61 73 54 | 65 78 74 53 65 72 76 69 |(!(gHasT|extServi|
|000054a0| 63 65 73 20 26 26 20 54 | 53 4d 4d 65 6e 75 53 65 |ces && T|SMMenuSe|
|000054b0| 6c 65 63 74 28 6d 65 6e | 75 52 65 73 75 6c 74 29 |lect(men|uResult)|
|000054c0| 29 29 0d 09 09 09 09 09 | 09 44 6f 4d 65 6e 75 43 |))......|.DoMenuC|
|000054d0| 6f 6d 6d 61 6e 64 28 6d | 65 6e 75 52 65 73 75 6c |ommand(m|enuResul|
|000054e0| 74 29 3b 0d 09 09 09 09 | 09 48 69 6c 69 74 65 4d |t);.....|.HiliteM|
|000054f0| 65 6e 75 28 30 29 3b 20 | 2f 2f 20 6e 65 65 64 65 |enu(0); |// neede|
|00005500| 64 20 65 76 65 6e 20 69 | 66 20 54 53 4d 20 6f 72 |d even i|f TSM or|
|00005510| 20 53 63 72 69 70 74 20 | 4d 61 6e 61 67 65 72 20 | Script |Manager |
|00005520| 68 61 6e 64 6c 65 20 74 | 68 65 20 6d 65 6e 75 0d |handle t|he menu.|
|00005530| 23 65 6c 73 65 20 2f 2f | 20 71 49 6e 6c 69 6e 65 |#else //| qInline|
|00005540| 0d 09 09 09 09 09 44 6f | 4d 65 6e 75 43 6f 6d 6d |......Do|MenuComm|
|00005550| 61 6e 64 28 4d 65 6e 75 | 53 65 6c 65 63 74 28 65 |and(Menu|Select(e|
|00005560| 76 65 6e 74 2d 3e 77 68 | 65 72 65 29 29 3b 0d 23 |vent->wh|ere));.#|
|00005570| 65 6e 64 69 66 20 2f 2f | 20 71 49 6e 6c 69 6e 65 |endif //| qInline|
|00005580| 0d 09 09 09 09 09 62 72 | 65 61 6b 3b 0d 09 09 09 |......br|eak;....|
|00005590| 09 63 61 73 65 20 69 6e | 53 79 73 57 69 6e 64 6f |.case in|SysWindo|
|000055a0| 77 3a 20 20 20 20 20 20 | 20 20 20 20 20 2f 2a 20 |w: | /* |
|000055b0| 6c 65 74 20 74 68 65 20 | 73 79 73 74 65 6d 20 68 |let the |system h|
|000055c0| 61 6e 64 6c 65 20 74 68 | 65 20 6d 6f 75 73 65 44 |andle th|e mouseD|
|000055d0| 6f 77 6e 20 2a 2f 0d 09 | 09 09 09 09 53 79 73 74 |own */..|....Syst|
|000055e0| 65 6d 43 6c 69 63 6b 28 | 65 76 65 6e 74 2c 20 77 |emClick(|event, w|
|000055f0| 69 6e 64 6f 77 29 3b 0d | 09 09 09 09 09 62 72 65 |indow);.|.....bre|
|00005600| 61 6b 3b 0d 09 09 09 09 | 63 61 73 65 20 69 6e 43 |ak;.....|case inC|
|00005610| 6f 6e 74 65 6e 74 3a 0d | 09 09 09 09 09 69 66 20 |ontent:.|.....if |
|00005620| 28 20 77 69 6e 64 6f 77 | 20 21 3d 20 46 72 6f 6e |( window| != Fron|
|00005630| 74 57 69 6e 64 6f 77 28 | 29 20 29 20 7b 0d 09 09 |tWindow(|) ) {...|
|00005640| 09 09 09 09 53 65 6c 65 | 63 74 57 69 6e 64 6f 77 |....Sele|ctWindow|
|00005650| 28 77 69 6e 64 6f 77 29 | 3b 0d 09 09 09 09 09 09 |(window)|;.......|
|00005660| 41 64 6a 75 73 74 4d 65 | 6e 75 73 28 29 3b 0d 09 |AdjustMe|nus();..|
|00005670| 09 09 09 09 7d 20 65 6c | 73 65 0d 09 09 09 09 09 |....} el|se......|
|00005680| 09 44 6f 43 6f 6e 74 65 | 6e 74 43 6c 69 63 6b 28 |.DoConte|ntClick(|
|00005690| 77 69 6e 64 6f 77 2c 20 | 65 76 65 6e 74 29 3b 0d |window, |event);.|
|000056a0| 09 09 09 09 09 62 72 65 | 61 6b 3b 0d 09 09 09 09 |.....bre|ak;.....|
|000056b0| 63 61 73 65 20 69 6e 44 | 72 61 67 3a 20 20 20 20 |case inD|rag: |
|000056c0| 20 20 20 20 20 20 20 20 | 20 20 20 20 2f 2a 20 70 | | /* p|
|000056d0| 61 73 73 20 73 63 72 65 | 65 6e 42 69 74 73 2e 62 |ass scre|enBits.b|
|000056e0| 6f 75 6e 64 73 20 74 6f | 20 67 65 74 20 61 6c 6c |ounds to| get all|
|000056f0| 20 67 44 65 76 69 63 65 | 73 20 2a 2f 0d 09 09 09 | gDevice|s */....|
|00005700| 09 09 44 72 61 67 57 69 | 6e 64 6f 77 28 77 69 6e |..DragWi|ndow(win|
|00005710| 64 6f 77 2c 20 65 76 65 | 6e 74 2d 3e 77 68 65 72 |dow, eve|nt->wher|
|00005720| 65 2c 20 26 71 64 2e 73 | 63 72 65 65 6e 42 69 74 |e, &qd.s|creenBit|
|00005730| 73 2e 62 6f 75 6e 64 73 | 29 3b 0d 09 09 09 09 09 |s.bounds|);......|
|00005740| 62 72 65 61 6b 3b 0d 09 | 09 09 09 63 61 73 65 20 |break;..|...case |
|00005750| 69 6e 47 6f 41 77 61 79 | 3a 0d 09 09 09 09 09 69 |inGoAway|:......i|
|00005760| 66 20 28 20 54 72 61 63 | 6b 47 6f 41 77 61 79 28 |f ( Trac|kGoAway(|
|00005770| 77 69 6e 64 6f 77 2c 20 | 65 76 65 6e 74 2d 3e 77 |window, |event->w|
|00005780| 68 65 72 65 29 20 29 0d | 09 09 09 09 09 09 44 6f |here) ).|......Do|
|00005790| 43 6c 6f 73 65 57 69 6e | 64 6f 77 28 77 69 6e 64 |CloseWin|dow(wind|
|000057a0| 6f 77 29 3b 20 2f 2a 20 | 77 65 20 64 6f 6e d5 74 |ow); /* |we don.t|
|000057b0| 20 63 61 72 65 20 69 66 | 20 74 68 65 20 75 73 65 | care if| the use|
|000057c0| 72 20 63 61 6e 63 65 6c | 6c 65 64 20 2a 2f 0d 09 |r cancel|led */..|
|000057d0| 09 09 09 09 62 72 65 61 | 6b 3b 0d 09 09 09 09 63 |....brea|k;.....c|
|000057e0| 61 73 65 20 69 6e 47 72 | 6f 77 3a 0d 09 09 09 09 |ase inGr|ow:.....|
|000057f0| 09 44 6f 47 72 6f 77 57 | 69 6e 64 6f 77 28 77 69 |.DoGrowW|indow(wi|
|00005800| 6e 64 6f 77 2c 20 65 76 | 65 6e 74 29 3b 0d 09 09 |ndow, ev|ent);...|
|00005810| 09 09 09 62 72 65 61 6b | 3b 0d 09 09 09 09 63 61 |...break|;.....ca|
|00005820| 73 65 20 69 6e 5a 6f 6f | 6d 49 6e 3a 0d 09 09 09 |se inZoo|mIn:....|
|00005830| 09 63 61 73 65 20 69 6e | 5a 6f 6f 6d 4f 75 74 3a |.case in|ZoomOut:|
|00005840| 0d 09 09 09 09 69 66 20 | 28 20 54 72 61 63 6b 42 |.....if |( TrackB|
|00005850| 6f 78 28 77 69 6e 64 6f | 77 2c 20 65 76 65 6e 74 |ox(windo|w, event|
|00005860| 2d 3e 77 68 65 72 65 2c | 20 70 61 72 74 29 20 29 |->where,| part) )|
|00005870| 0d 09 09 09 09 09 09 44 | 6f 5a 6f 6f 6d 57 69 6e |.......D|oZoomWin|
|00005880| 64 6f 77 28 77 69 6e 64 | 6f 77 2c 20 70 61 72 74 |dow(wind|ow, part|
|00005890| 29 3b 0d 09 09 09 09 09 | 62 72 65 61 6b 3b 0d 09 |);......|break;..|
|000058a0| 09 09 7d 0d 09 09 09 62 | 72 65 61 6b 3b 0d 09 09 |..}....b|reak;...|
|000058b0| 63 61 73 65 20 6b 65 79 | 44 6f 77 6e 3a 0d 09 09 |case key|Down:...|
|000058c0| 63 61 73 65 20 61 75 74 | 6f 4b 65 79 3a 20 20 20 |case aut|oKey: |
|000058d0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000058e0| 20 20 20 20 2f 2a 20 63 | 68 65 63 6b 20 66 6f 72 | /* c|heck for|
|000058f0| 20 6d 65 6e 75 6b 65 79 | 20 65 71 75 69 76 61 6c | menukey| equival|
|00005900| 65 6e 74 73 20 2a 2f 0d | 09 09 09 6b 65 79 20 3d |ents */.|...key =|
|00005910| 20 65 76 65 6e 74 2d 3e | 6d 65 73 73 61 67 65 20 | event->|message |
|00005920| 26 20 63 68 61 72 43 6f | 64 65 4d 61 73 6b 3b 0d |& charCo|deMask;.|
|00005930| 09 09 09 69 66 20 28 20 | 65 76 65 6e 74 2d 3e 6d |...if ( |event->m|
|00005940| 6f 64 69 66 69 65 72 73 | 20 26 20 63 6d 64 4b 65 |odifiers| & cmdKe|
|00005950| 79 20 29 20 7b 09 2f 2a | 20 43 6f 6d 6d 61 6e 64 |y ) {./*| Command|
|00005960| 20 6b 65 79 20 64 6f 77 | 6e 20 2a 2f 0d 09 09 09 | key dow|n */....|
|00005970| 09 69 66 20 28 20 65 76 | 65 6e 74 2d 3e 77 68 61 |.if ( ev|ent->wha|
|00005980| 74 20 3d 3d 20 6b 65 79 | 44 6f 77 6e 20 29 20 7b |t == key|Down ) {|
|00005990| 0d 09 09 09 09 09 41 64 | 6a 75 73 74 4d 65 6e 75 |......Ad|justMenu|
|000059a0| 73 28 29 3b 09 09 09 2f | 2a 20 65 6e 61 62 6c 65 |s();.../|* enable|
|000059b0| 2f 64 69 73 61 62 6c 65 | 2f 63 68 65 63 6b 20 6d |/disable|/check m|
|000059c0| 65 6e 75 20 69 74 65 6d | 73 20 70 72 6f 70 65 72 |enu item|s proper|
|000059d0| 6c 79 20 2a 2f 0d 09 09 | 09 09 09 44 6f 4d 65 6e |ly */...|...DoMen|
|000059e0| 75 43 6f 6d 6d 61 6e 64 | 28 4d 65 6e 75 4b 65 79 |uCommand|(MenuKey|
|000059f0| 28 6b 65 79 29 29 3b 0d | 09 09 09 09 7d 0d 09 09 |(key));.|....}...|
|00005a00| 09 7d 20 65 6c 73 65 0d | 09 09 09 09 44 6f 4b 65 |.} else.|....DoKe|
|00005a10| 79 44 6f 77 6e 28 65 76 | 65 6e 74 29 3b 0d 09 09 |yDown(ev|ent);...|
|00005a20| 09 62 72 65 61 6b 3b 0d | 09 09 63 61 73 65 20 61 |.break;.|..case a|
|00005a30| 63 74 69 76 61 74 65 45 | 76 74 3a 0d 09 09 09 44 |ctivateE|vt:....D|
|00005a40| 6f 41 63 74 69 76 61 74 | 65 28 28 57 69 6e 64 6f |oActivat|e((Windo|
|00005a50| 77 50 74 72 29 20 65 76 | 65 6e 74 2d 3e 6d 65 73 |wPtr) ev|ent->mes|
|00005a60| 73 61 67 65 2c 20 28 65 | 76 65 6e 74 2d 3e 6d 6f |sage, (e|vent->mo|
|00005a70| 64 69 66 69 65 72 73 20 | 26 20 61 63 74 69 76 65 |difiers |& active|
|00005a80| 46 6c 61 67 29 20 21 3d | 20 30 29 3b 0d 09 09 09 |Flag) !=| 0);....|
|00005a90| 62 72 65 61 6b 3b 0d 09 | 09 63 61 73 65 20 75 70 |break;..|.case up|
|00005aa0| 64 61 74 65 45 76 74 3a | 0d 09 09 09 44 6f 55 70 |dateEvt:|....DoUp|
|00005ab0| 64 61 74 65 28 28 57 69 | 6e 64 6f 77 50 74 72 29 |date((Wi|ndowPtr)|
|00005ac0| 20 65 76 65 6e 74 2d 3e | 6d 65 73 73 61 67 65 29 | event->|message)|
|00005ad0| 3b 0d 09 09 09 62 72 65 | 61 6b 3b 0d 09 09 2f 2a |;....bre|ak;.../*|
|00005ae0| 09 31 2e 30 31 20 2d 20 | 49 74 20 69 73 20 6e 6f |.1.01 - |It is no|
|00005af0| 74 20 61 20 62 61 64 20 | 69 64 65 61 20 74 6f 20 |t a bad |idea to |
|00005b00| 61 74 20 6c 65 61 73 74 | 20 63 61 6c 6c 20 44 49 |at least| call DI|
|00005b10| 42 61 64 4d 6f 75 6e 74 | 20 69 6e 20 72 65 73 70 |BadMount| in resp|
|00005b20| 6f 6e 73 65 0d 09 09 09 | 74 6f 20 61 20 64 69 73 |onse....|to a dis|
|00005b30| 6b 45 76 74 2c 20 73 6f | 20 74 68 61 74 20 74 68 |kEvt, so| that th|
|00005b40| 65 20 75 73 65 72 20 63 | 61 6e 20 66 6f 72 6d 61 |e user c|an forma|
|00005b50| 74 20 61 20 66 6c 6f 70 | 70 79 2e 20 2a 2f 0d 09 |t a flop|py. */..|
|00005b60| 09 63 61 73 65 20 64 69 | 73 6b 45 76 74 3a 0d 09 |.case di|skEvt:..|
|00005b70| 09 09 69 66 20 28 20 48 | 69 57 6f 72 64 28 65 76 |..if ( H|iWord(ev|
|00005b80| 65 6e 74 2d 3e 6d 65 73 | 73 61 67 65 29 20 21 3d |ent->mes|sage) !=|
|00005b90| 20 6e 6f 45 72 72 20 29 | 20 7b 0d 09 09 09 09 53 | noErr )| {.....S|
|00005ba0| 65 74 50 74 28 26 61 50 | 6f 69 6e 74 2c 20 6b 44 |etPt(&aP|oint, kD|
|00005bb0| 49 4c 65 66 74 2c 20 6b | 44 49 54 6f 70 29 3b 0d |ILeft, k|DITop);.|
|00005bc0| 09 09 09 09 65 72 72 20 | 3d 20 44 49 42 61 64 4d |....err |= DIBadM|
|00005bd0| 6f 75 6e 74 28 61 50 6f | 69 6e 74 2c 20 65 76 65 |ount(aPo|int, eve|
|00005be0| 6e 74 2d 3e 6d 65 73 73 | 61 67 65 29 3b 0d 09 09 |nt->mess|age);...|
|00005bf0| 09 7d 0d 09 09 09 62 72 | 65 61 6b 3b 0d 09 09 63 |.}....br|eak;...c|
|00005c00| 61 73 65 20 6f 73 45 76 | 74 3a 0d 09 09 2f 2a 09 |ase osEv|t:.../*.|
|00005c10| 31 2e 30 32 20 2d 20 6d | 75 73 74 20 42 69 74 41 |1.02 - m|ust BitA|
|00005c20| 4e 44 20 77 69 74 68 20 | 30 78 30 46 46 20 74 6f |ND with |0x0FF to|
|00005c30| 20 67 65 74 20 6f 6e 6c | 79 20 6c 6f 77 20 62 79 | get onl|y low by|
|00005c40| 74 65 20 2a 2f 0d 09 09 | 09 73 77 69 74 63 68 20 |te */...|.switch |
|00005c50| 28 28 65 76 65 6e 74 2d | 3e 6d 65 73 73 61 67 65 |((event-|>message|
|00005c60| 20 3e 3e 20 32 34 29 20 | 26 20 30 78 30 46 46 29 | >> 24) |& 0x0FF)|
|00005c70| 20 7b 09 09 2f 2a 20 68 | 69 67 68 20 62 79 74 65 | {../* h|igh byte|
|00005c80| 20 6f 66 20 6d 65 73 73 | 61 67 65 20 2a 2f 0d 09 | of mess|age */..|
|00005c90| 09 09 09 63 61 73 65 20 | 6d 6f 75 73 65 4d 6f 76 |...case |mouseMov|
|00005ca0| 65 64 4d 65 73 73 61 67 | 65 3a 0d 09 09 09 09 09 |edMessag|e:......|
|00005cb0| 44 6f 49 64 6c 65 28 29 | 3b 09 09 09 09 09 2f 2a |DoIdle()|;...../*|
|00005cc0| 20 6d 6f 75 73 65 2d 6d | 6f 76 65 64 20 69 73 20 | mouse-m|oved is |
|00005cd0| 61 6c 73 6f 20 61 6e 20 | 69 64 6c 65 20 65 76 65 |also an |idle eve|
|00005ce0| 6e 74 20 2a 2f 0d 09 09 | 09 09 09 62 72 65 61 6b |nt */...|...break|
|00005cf0| 3b 0d 09 09 09 09 63 61 | 73 65 20 73 75 73 70 65 |;.....ca|se suspe|
|00005d00| 6e 64 52 65 73 75 6d 65 | 4d 65 73 73 61 67 65 3a |ndResume|Message:|
|00005d10| 09 09 2f 2a 20 73 75 73 | 70 65 6e 64 2f 72 65 73 |../* sus|pend/res|
|00005d20| 75 6d 65 20 69 73 20 61 | 6c 73 6f 20 61 6e 20 61 |ume is a|lso an a|
|00005d30| 63 74 69 76 61 74 65 2f | 64 65 61 63 74 69 76 61 |ctivate/|deactiva|
|00005d40| 74 65 20 2a 2f 0d 09 09 | 09 09 09 67 49 6e 42 61 |te */...|...gInBa|
|00005d50| 63 6b 67 72 6f 75 6e 64 | 20 3d 20 28 65 76 65 6e |ckground| = (even|
|00005d60| 74 2d 3e 6d 65 73 73 61 | 67 65 20 26 20 72 65 73 |t->messa|ge & res|
|00005d70| 75 6d 65 46 6c 61 67 29 | 20 3d 3d 20 30 3b 0d 09 |umeFlag)| == 0;..|
|00005d80| 09 09 09 09 44 6f 41 63 | 74 69 76 61 74 65 28 46 |....DoAc|tivate(F|
|00005d90| 72 6f 6e 74 57 69 6e 64 | 6f 77 28 29 2c 20 21 67 |rontWind|ow(), !g|
|00005da0| 49 6e 42 61 63 6b 67 72 | 6f 75 6e 64 29 3b 0d 09 |InBackgr|ound);..|
|00005db0| 09 09 09 09 62 72 65 61 | 6b 3b 0d 09 09 09 7d 0d |....brea|k;....}.|
|00005dc0| 09 09 09 62 72 65 61 6b | 3b 0d 23 69 66 20 71 41 |...break|;.#if qA|
|00005dd0| 70 70 6c 65 45 76 65 6e | 74 73 0d 09 09 63 61 73 |ppleEven|ts...cas|
|00005de0| 65 20 6b 48 69 67 68 4c | 65 76 65 6c 45 76 65 6e |e kHighL|evelEven|
|00005df0| 74 3a 0d 09 09 09 69 66 | 20 28 41 45 50 72 6f 63 |t:....if| (AEProc|
|00005e00| 65 73 73 41 70 70 6c 65 | 45 76 65 6e 74 28 65 76 |essApple|Event(ev|
|00005e10| 65 6e 74 29 20 21 3d 20 | 6e 6f 45 72 72 29 0d 09 |ent) != |noErr)..|
|00005e20| 09 09 09 3b 20 2f 2f 20 | 61 6e 79 20 69 64 65 61 |...; // |any idea|
|00005e30| 73 20 66 6f 72 20 65 72 | 72 6f 72 20 68 61 6e 64 |s for er|ror hand|
|00005e40| 6c 69 6e 67 3f 0d 09 09 | 09 62 72 65 61 6b 3b 0d |ling?...|.break;.|
|00005e50| 23 65 6e 64 69 66 20 2f | 2f 20 71 41 70 70 6c 65 |#endif /|/ qApple|
|00005e60| 45 76 65 6e 74 73 0d 09 | 7d 0d 7d 20 2f 2a 44 6f |Events..|}.} /*Do|
|00005e70| 45 76 65 6e 74 2a 2f 0d | 0d 0d 2f 2a 09 43 68 61 |Event*/.|../*.Cha|
|00005e80| 6e 67 65 20 74 68 65 20 | 63 75 72 73 6f 72 27 73 |nge the |cursor's|
|00005e90| 20 73 68 61 70 65 2c 20 | 64 65 70 65 6e 64 69 6e | shape, |dependin|
|00005ea0| 67 20 6f 6e 20 69 74 73 | 20 70 6f 73 69 74 69 6f |g on its| positio|
|00005eb0| 6e 2e 20 54 68 69 73 20 | 61 6c 73 6f 20 63 61 6c |n. This |also cal|
|00005ec0| 63 75 6c 61 74 65 73 20 | 74 68 65 20 72 65 67 69 |culates |the regi|
|00005ed0| 6f 6e 0d 09 77 68 65 72 | 65 20 74 68 65 20 63 75 |on..wher|e the cu|
|00005ee0| 72 72 65 6e 74 20 63 75 | 72 73 6f 72 20 72 65 73 |rrent cu|rsor res|
|00005ef0| 69 64 65 73 20 28 66 6f | 72 20 57 61 69 74 4e 65 |ides (fo|r WaitNe|
|00005f00| 78 74 45 76 65 6e 74 29 | 2e 20 57 68 65 6e 20 74 |xtEvent)|. When t|
|00005f10| 68 65 20 6d 6f 75 73 65 | 20 6d 6f 76 65 73 20 6f |he mouse| moves o|
|00005f20| 75 74 73 69 64 65 20 6f | 66 0d 09 74 68 69 73 20 |utside o|f..this |
|00005f30| 72 65 67 69 6f 6e 2c 20 | 61 6e 20 65 76 65 6e 74 |region, |an event|
|00005f40| 20 69 73 20 67 65 6e 65 | 72 61 74 65 64 2e 20 49 | is gene|rated. I|
|00005f50| 66 20 74 68 65 72 65 20 | 69 73 20 6d 6f 72 65 20 |f there |is more |
|00005f60| 74 6f 20 74 68 65 20 65 | 76 65 6e 74 20 74 68 61 |to the e|vent tha|
|00005f70| 6e 20 6a 75 73 74 0d 09 | d2 74 68 65 20 6d 6f 75 |n just..|.the mou|
|00005f80| 73 65 20 6d 6f 76 65 64 | d3 2c 20 77 65 20 67 65 |se moved|., we ge|
|00005f90| 74 20 63 61 6c 6c 65 64 | 20 62 65 66 6f 72 65 20 |t called| before |
|00005fa0| 74 68 65 20 65 76 65 6e | 74 20 69 73 20 70 72 6f |the even|t is pro|
|00005fb0| 63 65 73 73 65 64 20 74 | 6f 20 6d 61 6b 65 20 73 |cessed t|o make s|
|00005fc0| 75 72 65 0d 09 74 68 65 | 20 63 75 72 73 6f 72 20 |ure..the| cursor |
|00005fd0| 69 73 20 74 68 65 20 72 | 69 67 68 74 20 6f 6e 65 |is the r|ight one|
|00005fe0| 2e 20 49 6e 20 61 6e 79 | 20 28 61 68 65 6d 29 20 |. In any| (ahem) |
|00005ff0| 65 76 65 6e 74 2c 20 74 | 68 69 73 20 69 73 20 63 |event, t|his is c|
|00006000| 61 6c 6c 65 64 20 61 67 | 61 69 6e 20 62 65 66 6f |alled ag|ain befo|
|00006010| 72 65 20 77 65 0d 09 66 | 61 6c 6c 20 62 61 63 6b |re we..f|all back|
|00006020| 20 69 6e 74 6f 20 57 4e | 45 2e 20 2a 2f 0d 0d 76 | into WN|E. */..v|
|00006030| 6f 69 64 20 41 64 6a 75 | 73 74 43 75 72 73 6f 72 |oid Adju|stCursor|
|00006040| 28 50 6f 69 6e 74 20 6d | 6f 75 73 65 2c 20 52 67 |(Point m|ouse, Rg|
|00006050| 6e 48 61 6e 64 6c 65 20 | 72 65 67 69 6f 6e 29 0d |nHandle |region).|
|00006060| 7b 0d 09 57 69 6e 64 6f | 77 50 74 72 09 77 69 6e |{..Windo|wPtr.win|
|00006070| 64 6f 77 3b 0d 09 52 67 | 6e 48 61 6e 64 6c 65 09 |dow;..Rg|nHandle.|
|00006080| 61 72 72 6f 77 52 67 6e | 3b 0d 09 52 67 6e 48 61 |arrowRgn|;..RgnHa|
|00006090| 6e 64 6c 65 09 69 42 65 | 61 6d 52 67 6e 3b 0d 09 |ndle.iBe|amRgn;..|
|000060a0| 52 65 63 74 09 09 69 42 | 65 61 6d 52 65 63 74 3b |Rect..iB|eamRect;|
|000060b0| 0d 0d 09 77 69 6e 64 6f | 77 20 3d 20 46 72 6f 6e |...windo|w = Fron|
|000060c0| 74 57 69 6e 64 6f 77 28 | 29 3b 09 2f 2a 20 77 65 |tWindow(|);./* we|
|000060d0| 20 6f 6e 6c 79 20 61 64 | 6a 75 73 74 20 74 68 65 | only ad|just the|
|000060e0| 20 63 75 72 73 6f 72 20 | 77 68 65 6e 20 77 65 20 | cursor |when we |
|000060f0| 61 72 65 20 69 6e 20 66 | 72 6f 6e 74 20 2a 2f 0d |are in f|ront */.|
|00006100| 09 69 66 20 28 20 28 21 | 20 67 49 6e 42 61 63 6b |.if ( (!| gInBack|
|00006110| 67 72 6f 75 6e 64 29 20 | 26 26 20 28 21 20 49 73 |ground) |&& (! Is|
|00006120| 44 41 57 69 6e 64 6f 77 | 28 77 69 6e 64 6f 77 29 |DAWindow|(window)|
|00006130| 29 20 29 20 7b 0d 09 09 | 2f 2a 20 63 61 6c 63 75 |) ) {...|/* calcu|
|00006140| 6c 61 74 65 20 72 65 67 | 69 6f 6e 73 20 66 6f 72 |late reg|ions for|
|00006150| 20 64 69 66 66 65 72 65 | 6e 74 20 63 75 72 73 6f | differe|nt curso|
|00006160| 72 20 73 68 61 70 65 73 | 20 2a 2f 0d 09 09 61 72 |r shapes| */...ar|
|00006170| 72 6f 77 52 67 6e 20 3d | 20 4e 65 77 52 67 6e 28 |rowRgn =| NewRgn(|
|00006180| 29 3b 0d 09 09 69 42 65 | 61 6d 52 67 6e 20 3d 20 |);...iBe|amRgn = |
|00006190| 4e 65 77 52 67 6e 28 29 | 3b 0d 0d 09 09 2f 2a 20 |NewRgn()|;..../* |
|000061a0| 73 74 61 72 74 20 61 72 | 72 6f 77 52 67 6e 20 77 |start ar|rowRgn w|
|000061b0| 69 64 65 20 6f 70 65 6e | 20 2a 2f 0d 09 09 53 65 |ide open| */...Se|
|000061c0| 74 52 65 63 74 52 67 6e | 28 61 72 72 6f 77 52 67 |tRectRgn|(arrowRg|
|000061d0| 6e 2c 20 6b 45 78 74 72 | 65 6d 65 4e 65 67 2c 20 |n, kExtr|emeNeg, |
|000061e0| 6b 45 78 74 72 65 6d 65 | 4e 65 67 2c 20 6b 45 78 |kExtreme|Neg, kEx|
|000061f0| 74 72 65 6d 65 50 6f 73 | 2c 20 6b 45 78 74 72 65 |tremePos|, kExtre|
|00006200| 6d 65 50 6f 73 29 3b 0d | 0d 09 09 2f 2a 20 63 61 |mePos);.|.../* ca|
|00006210| 6c 63 75 6c 61 74 65 20 | 69 42 65 61 6d 52 67 6e |lculate |iBeamRgn|
|00006220| 20 2a 2f 0d 09 09 69 66 | 20 28 20 49 73 44 6f 63 | */...if| ( IsDoc|
|00006230| 75 6d 65 6e 74 57 69 6e | 64 6f 77 28 77 69 6e 64 |umentWin|dow(wind|
|00006240| 6f 77 29 20 29 20 7b 0d | 09 09 09 69 42 65 61 6d |ow) ) {.|...iBeam|
|00006250| 52 65 63 74 20 3d 20 28 | 2a 28 28 44 6f 63 75 6d |Rect = (|*((Docum|
|00006260| 65 6e 74 50 65 65 6b 29 | 20 77 69 6e 64 6f 77 29 |entPeek)| window)|
|00006270| 2d 3e 64 6f 63 54 45 29 | 2d 3e 76 69 65 77 52 65 |->docTE)|->viewRe|
|00006280| 63 74 3b 0d 09 09 09 53 | 65 74 50 6f 72 74 28 77 |ct;....S|etPort(w|
|00006290| 69 6e 64 6f 77 29 3b 09 | 2f 2a 20 6d 61 6b 65 20 |indow);.|/* make |
|000062a0| 61 20 67 6c 6f 62 61 6c | 20 76 65 72 73 69 6f 6e |a global| version|
|000062b0| 20 6f 66 20 74 68 65 20 | 76 69 65 77 52 65 63 74 | of the |viewRect|
|000062c0| 20 2a 2f 0d 09 09 09 2f | 2f 20 3f 3f 3f 20 66 6f | */..../|/ ??? fo|
|000062d0| 6c 6c 6f 77 69 6e 67 20 | 74 77 6f 20 6c 69 6e 65 |llowing |two line|
|000062e0| 73 20 64 65 70 65 6e 64 | 20 6f 6e 20 52 65 63 74 |s depend| on Rect|
|000062f0| 20 73 74 72 75 63 74 75 | 72 65 20 6c 61 79 6f 75 | structu|re layou|
|00006300| 74 0d 09 09 09 4c 6f 63 | 61 6c 54 6f 47 6c 6f 62 |t....Loc|alToGlob|
|00006310| 61 6c 28 28 50 6f 69 6e | 74 20 2a 29 20 26 28 69 |al((Poin|t *) &(i|
|00006320| 42 65 61 6d 52 65 63 74 | 29 2e 74 6f 70 29 3b 0d |BeamRect|).top);.|
|00006330| 09 09 09 4c 6f 63 61 6c | 54 6f 47 6c 6f 62 61 6c |...Local|ToGlobal|
|00006340| 28 28 50 6f 69 6e 74 20 | 2a 29 20 26 28 69 42 65 |((Point |*) &(iBe|
|00006350| 61 6d 52 65 63 74 29 2e | 62 6f 74 74 6f 6d 29 3b |amRect).|bottom);|
|00006360| 0d 09 09 09 52 65 63 74 | 52 67 6e 28 69 42 65 61 |....Rect|Rgn(iBea|
|00006370| 6d 52 67 6e 2c 20 26 69 | 42 65 61 6d 52 65 63 74 |mRgn, &i|BeamRect|
|00006380| 29 3b 0d 09 09 09 2f 2a | 20 77 65 20 74 65 6d 70 |);..../*| we temp|
|00006390| 6f 72 61 72 69 6c 79 20 | 63 68 61 6e 67 65 20 74 |orarily |change t|
|000063a0| 68 65 20 70 6f 72 74 d5 | 73 20 6f 72 69 67 69 6e |he port.|s origin|
|000063b0| 20 74 6f 20 d2 67 6c 6f | 62 61 6c 66 79 d3 20 74 | to .glo|balfy. t|
|000063c0| 68 65 20 76 69 73 52 67 | 6e 20 2a 2f 0d 09 09 09 |he visRg|n */....|
|000063d0| 53 65 74 4f 72 69 67 69 | 6e 28 2d 77 69 6e 64 6f |SetOrigi|n(-windo|
|000063e0| 77 2d 3e 70 6f 72 74 42 | 69 74 73 2e 62 6f 75 6e |w->portB|its.boun|
|000063f0| 64 73 2e 6c 65 66 74 2c | 20 2d 77 69 6e 64 6f 77 |ds.left,| -window|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.